]> git.cworth.org Git - apitrace/blobdiff - formatter.hpp
First working on demand loading!
[apitrace] / formatter.hpp
index 3c9db3ca25a89e318424c438257e2c490d2bdf2c..181e2d1539d5c14bc14e070db1325a31d2593ad4 100644 (file)
  *
  **************************************************************************/
 
+/*
+ * Helpers for coloring output.
+ */
+
 #ifndef _FORMATTER_HPP_
 #define _FORMATTER_HPP_
 
@@ -101,7 +105,7 @@ inline std::ostream& operator<<(std::ostream& os, const Attribute *attr) {
 }
 
 
-#ifdef WIN32
+#ifdef _WIN32
 
 #include <windows.h>
 
@@ -151,12 +155,16 @@ public:
 #endif
 
 
-inline Formatter *defaultFormatter(void) {
-#ifdef WIN32
-    return new WindowsFormatter;
+inline Formatter *defaultFormatter(bool color = true) {
+    if (color) {
+#ifdef _WIN32
+        return new WindowsFormatter;
 #else
-    return new AnsiFormatter;
+        return new AnsiFormatter;
 #endif
+    } else {
+        return new Formatter;
+    }
 }