20 static bool isZLibCompressed(const std::string &filename);
21 static bool isSnappyCompressed(const std::string &filename);
23 File(const std::string &filename = std::string(),
24 File::Mode mode = File::Read);
27 bool isOpened() const;
28 File::Mode mode() const;
29 std::string filename() const;
31 bool open(const std::string &filename, File::Mode mode);
32 bool write(const void *buffer, int length);
33 bool read(void *buffer, int length);
35 void flush(FlushType type = FlushShallow);
39 virtual bool rawOpen(const std::string &filename, File::Mode mode) = 0;
40 virtual bool rawWrite(const void *buffer, int length) = 0;
41 virtual bool rawRead(void *buffer, int length) = 0;
42 virtual int rawGetc() = 0;
43 virtual void rawClose() = 0;
44 virtual void rawFlush(FlushType type) = 0;
47 std::string m_filename;
52 class ZLibFile : public File {
54 ZLibFile(const std::string &filename = std::string(),
55 File::Mode mode = File::Read);
59 virtual bool rawOpen(const std::string &filename, File::Mode mode);
60 virtual bool rawWrite(const void *buffer, int length);
61 virtual bool rawRead(void *buffer, int length);
62 virtual int rawGetc();
63 virtual void rawClose();
64 virtual void rawFlush(FlushType type);