]> git.notmuchmail.org Git - apitrace/blobdiff - retrace.hpp
Uniformize warning output.
[apitrace] / retrace.hpp
index c87fc946c9e5e8e647473f2352179ccbfdd34669..69cf0ad4d2c171a69de8b56a5c0b4670a6cc5809 100644 (file)
 #ifndef _RETRACE_HPP_
 #define _RETRACE_HPP_
 
+#include <string.h>
+
+#include <list>
 #include <map>
+#include <ostream>
+
+#include "trace_model.hpp"
+
 
 namespace retrace {
 
@@ -73,6 +80,53 @@ public:
 };
 
 
+/**
+ * Output verbosity when retracing files.
+ */
+extern int verbosity;
+
+
+std::ostream &warning(Trace::Call &call);
+
+
+void ignore(Trace::Call &call);
+void unknown(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;
+  }
+};
+
+
+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 */
 
 #endif /* _RETRACE_HPP_ */