Read,
Write
};
+ enum FlushType {
+ FlushShallow,
+ FlushDeep
+ };
public:
static bool isZLibCompressed(const std::string &filename);
+ static bool isSnappyCompressed(const std::string &filename);
public:
File(const std::string &filename = std::string(),
File::Mode mode = File::Read);
bool write(const void *buffer, int length);
bool read(void *buffer, int length);
void close();
- void flush();
+ void flush(FlushType type = FlushShallow);
int getc();
protected:
virtual bool rawRead(void *buffer, int length) = 0;
virtual int rawGetc() = 0;
virtual void rawClose() = 0;
- virtual void rawFlush() = 0;
+ virtual void rawFlush(FlushType type) = 0;
protected:
std::string m_filename;
virtual bool rawRead(void *buffer, int length);
virtual int rawGetc();
virtual void rawClose();
- virtual void rawFlush();
+ virtual void rawFlush(FlushType type);
private:
void *m_gzFile;
};
virtual bool rawRead(void *buffer, int length);
virtual int rawGetc();
virtual void rawClose();
- virtual void rawFlush();
+ virtual void rawFlush(FlushType type);
private:
inline int freeCacheSize() const