]> git.cworth.org Git - apitrace/blobdiff - retrace.hpp
Use Cocoa on Mac OS X.
[apitrace] / retrace.hpp
index 56fc330e74316d82f64a175c3af963c12334bb4c..300f00757aed19648a930a7cc8e9e98db3cd70ec 100644 (file)
 #ifndef _RETRACE_HPP_
 #define _RETRACE_HPP_
 
+#include <string.h>
+
+#include <list>
 #include <map>
+#include <ostream>
 
 #include "trace_model.hpp"
 
@@ -82,9 +86,45 @@ public:
 extern int verbosity;
 
 
-void retrace_call(Trace::Call &call);
+std::ostream &warning(Trace::Call &call);
+
+
+void ignore(Trace::Call &call);
+void unsupported(Trace::Call &call);
+
+
+typedef void (*Callback)(Trace::Call &call);
+
+struct Entry {
+    const char *name;
+    Callback callback;
+};
+
+
+struct stringComparer {
+  bool operator() (const char *a, const  char *b) const {
+    return strcmp(a, b) < 0;
+  }
+};
 
-void retrace_unknown(Trace::Call &call);
+
+class Retracer
+{
+    typedef std::map<const char *, Callback, stringComparer> Map;
+    Map map;
+
+    std::vector<Callback> callbacks;
+
+public:
+    Retracer() {}
+
+    virtual ~Retracer() {}
+
+    void addCallback(const Entry *entry);
+    void addCallbacks(const Entry *entries);
+
+    void retrace(Trace::Call &call);
+};
 
 
 } /* namespace retrace */