X-Git-Url: https://git.cworth.org/git?a=blobdiff_plain;f=trace_file.hpp;h=13b392cdaa8876729791fb641a2e1f747f2dca8b;hb=46c4a32730c5b52c119376042a84a6773d8d789f;hp=2129d1e388f197b9e2cd7e844ddcf836b3e4cbdc;hpb=f562f318ddee6da2041696887e2195fc3c96d740;p=apitrace diff --git a/trace_file.hpp b/trace_file.hpp index 2129d1e..13b392c 100644 --- a/trace_file.hpp +++ b/trace_file.hpp @@ -67,6 +67,7 @@ public: void close(); void flush(void); int getc(); + bool skip(unsigned length); virtual bool supportsOffsets() const = 0; virtual File::Offset currentOffset(); @@ -78,6 +79,7 @@ protected: virtual int rawGetc() = 0; virtual void rawClose() = 0; virtual void rawFlush() = 0; + virtual bool rawSkip(unsigned length) = 0; protected: std::string m_filename; @@ -148,6 +150,14 @@ inline int File::getc() return rawGetc(); } +inline bool File::skip(unsigned length) +{ + if (!m_isOpened || m_mode != File::Read) { + return false; + } + return rawSkip(length); +} + class ZLibFile : public File { public: ZLibFile(const std::string &filename = std::string(), @@ -163,6 +173,7 @@ protected: virtual int rawGetc(); virtual void rawClose(); virtual void rawFlush(); + virtual bool rawSkip(unsigned length); private: void *m_gzFile; };