00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifndef IXE_MappedGzFile_H
00025 #define IXE_MappedGzFile_H
00026
00027
00028 #include "io/mappedFile.h"
00029 #include "include/error.h"
00030
00031 namespace IXE {
00032
00033 namespace io {
00034
00036 class ZlibError : public RuntimeError {
00037 public:
00038 ZlibError(std::string const& msg) : RuntimeError(msg) {}
00039 };
00040
00044 class MappedGzFileView : public MappedFileView
00045 {
00046 public:
00051 MappedGzFileView(FileHandle* fh, off64_t offset, Size len);
00052
00058 Size inflate(byte* dest, Size len);
00059 };
00060
00064 class MappedGzFile : public mappedFile
00065 {
00066 public:
00067 MappedGzFile() : usize(0), contents(0) { }
00068
00074 MappedGzFile(char const* filename, Size size, byte* dest = 0);
00075
00076 bool open(char const* filename, Size size, byte* dest = 0);
00077
00078 ~MappedGzFile() { delete[] contents; }
00079
00080 const_iterator begin() const { return (const_iterator)contents; }
00081 const_iterator end() const { return begin() + usize; }
00082 const_reverse_iterator rbegin() const { return const_reverse_iterator(end()); }
00083 const_reverse_iterator rend() const { return const_reverse_iterator(begin()); }
00084
00086 size_type size() const { return usize; }
00087
00088 private:
00089 size_type usize;
00090 char* contents;
00091 };
00092
00093 }
00094 }
00095
00096
00097 #endif // IXE_MappedGzFile_H