]> git.cworth.org Git - apitrace/blobdiff - trace_model.hpp
Show thumbnail of the color buffer in tooltips.
[apitrace] / trace_model.hpp
index b3a118ae24cec562568eca53b02f2159046677fd..a74508efc5e0a0fc2411f9fe19b3e1aea070beda 100644 (file)
@@ -34,7 +34,6 @@
 #include <assert.h>
 
 #include <map>
-#include <list>
 #include <vector>
 #include <iostream>
 
@@ -97,10 +96,13 @@ public:
     virtual double toDouble(void) const;
 
     virtual void *toPointer(void) const;
+    virtual void *toPointer(bool bind);
     virtual unsigned long long toUIntPtr(void) const;
     virtual const char *toString(void) const;
 
     const Value & operator[](size_t index) const;
+
+    void dump(std::ostream &os, bool color=true);
 };
 
 
@@ -113,6 +115,7 @@ public:
     virtual float toFloat(void) const;
     virtual double toDouble(void) const;
     void *toPointer(void) const;
+    void *toPointer(bool bind);
     unsigned long long toUIntPtr(void) const;
     const char *toString(void) const;
     void visit(Visitor &visitor);
@@ -187,6 +190,7 @@ class String : public Value
 {
 public:
     String(const char * _value) : value(_value) {}
+    ~String();
 
     bool toBool(void) const;
     const char *toString(void) const;
@@ -256,16 +260,19 @@ public:
     Blob(size_t _size) {
         size = _size;
         buf = new char[_size];
+        bound = false;
     }
 
     ~Blob();
 
     bool toBool(void) const;
     void *toPointer(void) const;
+    void *toPointer(bool bind);
     void visit(Visitor &visitor);
 
     size_t size;
     char *buf;
+    bool bound;
 };
 
 
@@ -276,6 +283,7 @@ public:
 
     bool toBool(void) const;
     void *toPointer(void) const;
+    void *toPointer(bool bind);
     unsigned long long toUIntPtr(void) const;
     void visit(Visitor &visitor);
 };
@@ -306,7 +314,12 @@ protected:
 };
 
 
-std::ostream & operator <<(std::ostream &os, Value *value);
+inline std::ostream & operator <<(std::ostream &os, Value *value) {
+    if (value) {
+        value->dump(os);
+    }
+    return os;
+}
 
 
 class Call
@@ -328,10 +341,15 @@ public:
         assert(index < args.size());
         return *(args[index]);
     }
+
+    void dump(std::ostream &os, bool color=true);
 };
 
 
-std::ostream & operator <<(std::ostream &os, Call &call);
+inline std::ostream & operator <<(std::ostream &os, Call &call) {
+    call.dump(os);
+    return os;
+}
 
 
 } /* namespace Trace */