]> git.cworth.org Git - apitrace/blobdiff - trace_parser.hpp
Some initial thoughts on the on-demand loading api.
[apitrace] / trace_parser.hpp
index 49e89087601b3148cc06ec940f6310290d4349f1..a000986c3631299292745dc213dca060406938d2 100644 (file)
 
 #include <iostream>
 #include <list>
-#include <string>
 
+#include "trace_file.hpp"
 #include "trace_format.hpp"
 #include "trace_model.hpp"
 
 
 namespace Trace {
 
-
 class Parser
 {
 protected:
-    void *file;
+    File *file;
 
     typedef std::list<Call *> CallList;
     CallList calls;
 
-    typedef std::vector<Call::Signature *> FunctionMap;
+    typedef std::vector<FunctionSig *> FunctionMap;
     FunctionMap functions;
 
-    typedef std::vector<Struct::Signature *> StructMap;
+    typedef std::vector<StructSig *> StructMap;
     StructMap structs;
 
-    typedef std::vector<Enum::Signature *> EnumMap;
+    typedef std::vector<EnumSig *> EnumMap;
     EnumMap enums;
 
-    typedef std::vector<Bitmask::Signature *> BitmaskMap;
+    typedef std::vector<BitmaskSig *> BitmaskMap;
     BitmaskMap bitmasks;
 
     unsigned next_call_no;
@@ -73,12 +72,27 @@ public:
 
     Call *parse_call(void);
 
+    bool supportsOffsets() const
+    {
+        return file-supportsOffsets();
+    }
+
+    File::Offset currentOffset()
+    {
+        return file->currentOffset();
+    }
+
+    void setCurrentOffset(const File::Offset &offset)
+    {
+        file->setCurrentOffset(offset);
+    }
+
 protected:
     void parse_enter(void);
 
     Call *parse_leave(void);
 
-    void parse_call_details(Call *call);
+    bool parse_call_details(Call *call);
 
     void parse_arg(Call *call);
 
@@ -106,7 +120,7 @@ protected:
 
     Value *parse_opaque();
 
-    std::string read_string(void);
+    const char * read_string(void);
 
     unsigned long long read_uint(void);