]> git.notmuchmail.org Git - apitrace/blobdiff - trace_model.hpp
Unify Bitmask::Pair with BitmaskVal.
[apitrace] / trace_model.hpp
index e7a2249c7c979833fbd8e7519ef3f18a5a9c22c0..a942ac99cd529281269304c84e23ad7040cbae9c 100644 (file)
 
 #include <assert.h>
 
-#include <string>
 #include <map>
 #include <list>
 #include <vector>
 #include <iostream>
 
+#include "trace_writer.hpp"
+
 
 namespace Trace {
 
 
 class Visitor;
-class Dumper;
-class UInt;
 
 
 class Value
@@ -150,26 +149,26 @@ public:
 class String : public Value
 {
 public:
-    String(std::string _value) : value(_value) {}
+    String(const char * _value) : value(_value) {}
 
     bool toBool(void) const;
     const char *toString(void) const;
     void visit(Visitor &visitor);
 
-    std::string value;
+    const char * value;
 };
 
 
 class Enum : public Value
 {
 public:
-    struct Signature : public std::pair<std::string, Value *>
+    struct Signature : public std::pair<const char *, Value *>
     {
         Signature()
-            : std::pair<std::string, Value *>()
+            : std::pair<const char *, Value *>()
         {}
-        Signature(const std::string &n, Trace::Value *val)
-            : std::pair<std::string, Value *>(n, val)
+        Signature(const char *n, Trace::Value *val)
+            : std::pair<const char *, Value *>(n, val)
         {}
         ~Signature()
         {
@@ -193,8 +192,7 @@ public:
 class Bitmask : public UInt
 {
 public:
-    typedef std::pair<std::string, unsigned long long> Pair;
-    typedef std::vector<Pair> Signature;
+    typedef std::vector<BitmaskVal> Signature;
 
     Bitmask(const Signature *_sig, unsigned long long _value) : UInt(_value), sig(_sig) {}
 
@@ -208,8 +206,8 @@ class Struct : public Value
 {
 public:
     struct Signature {
-        std::string name;
-        std::vector<std::string> member_names;
+        const char *name;
+        std::vector<const char *> member_names;
     };
 
     Struct(Signature *_sig) : sig(_sig), members(_sig->member_names.size()) { }
@@ -299,8 +297,8 @@ class Call
 {
 public:
     struct Signature {
-        std::string name;
-        std::vector<std::string> arg_names;
+        const char * name;
+        std::vector<const char *> arg_names;
     };
 
     unsigned no;
@@ -311,7 +309,7 @@ public:
     Call(Signature *_sig) : sig(_sig), args(_sig->arg_names.size()), ret(0) { }
     ~Call();
 
-    inline const std::string & name(void) const {
+    inline const char * name(void) const {
         return sig->name;
     }