X-Git-Url: https://git.cworth.org/git?a=blobdiff_plain;f=formatter.hpp;h=181e2d1539d5c14bc14e070db1325a31d2593ad4;hb=d029d5f345606eae27062882ce86e6790482be86;hp=3c9db3ca25a89e318424c438257e2c490d2bdf2c;hpb=19828970d2187334cae82f239f788b9f3a3912c6;p=apitrace diff --git a/formatter.hpp b/formatter.hpp index 3c9db3c..181e2d1 100644 --- a/formatter.hpp +++ b/formatter.hpp @@ -23,6 +23,10 @@ * **************************************************************************/ +/* + * 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 @@ -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; + } }