]> git.cworth.org Git - apitrace/blobdiff - trace_snappyfile.hpp
Some initial thoughts on the on-demand loading api.
[apitrace] / trace_snappyfile.hpp
index 7fab8351d42711958644d33be1c30251ae3b6fa6..6c0c9add1f8fbe72e33703baccaf0075b57fea4f 100644 (file)
@@ -52,6 +52,9 @@ public:
                File::Mode mode = File::Read);
     virtual ~SnappyFile();
 
+    virtual bool supportsOffsets() const;
+    virtual File::Offset currentOffset();
+    virtual void setCurrentOffset(const File::Offset &offset);
 protected:
     virtual bool rawOpen(const std::string &filename, File::Mode mode);
     virtual bool rawWrite(const void *buffer, int length);
@@ -68,6 +71,11 @@ private:
         else
             return 0;
     }
+    inline bool endOfData() const
+    {
+        return m_stream.eof() && freeCacheSize() == 0;
+    }
+
     void flushCache();
     void createCache(size_t size);
     void writeCompressedLength(uint32_t  num);
@@ -79,6 +87,8 @@ private:
     size_t m_cacheSize;
 
     char *m_compressedCache;
+
+    File::Offset m_currentOffset;
 };
 
 }