#include <iostream>
+#ifdef _WIN32
+#include <windows.h>
+
+#ifndef COMMON_LVB_LEADING_BYTE
+#define COMMON_LVB_LEADING_BYTE 0x0100
+#endif
+
+#ifndef COMMON_LVB_TRAILING_BYTE
+#define COMMON_LVB_TRAILING_BYTE 0x0200
+#endif
+
+#ifndef COMMON_LVB_GRID_HORIZONTAL
+#define COMMON_LVB_GRID_HORIZONTAL 0x0400
+#endif
+
+#ifndef COMMON_LVB_GRID_LVERTICAL
+#define COMMON_LVB_GRID_LVERTICAL 0x0800
+#endif
+
+#ifndef COMMON_LVB_GRID_RVERTICAL
+#define COMMON_LVB_GRID_RVERTICAL 0x1000
+#endif
+
+#ifndef COMMON_LVB_REVERSE_VIDEO
+#define COMMON_LVB_REVERSE_VIDEO 0x4000
+#endif
+
+#ifndef COMMON_LVB_UNDERSCORE
+#define COMMON_LVB_UNDERSCORE 0x8000
+#endif
+
+#endif /* _WIN32 */
+
namespace formatter {
#ifdef _WIN32
-#include <windows.h>
-
-
-#ifndef COMMON_LVB_LEADING_BYTE
-#define COMMON_LVB_LEADING_BYTE 0x0100
-#endif
-
-#ifndef COMMON_LVB_TRAILING_BYTE
-#define COMMON_LVB_TRAILING_BYTE 0x0200
-#endif
-
-#ifndef COMMON_LVB_GRID_HORIZONTAL
-#define COMMON_LVB_GRID_HORIZONTAL 0x0400
-#endif
-
-#ifndef COMMON_LVB_GRID_LVERTICAL
-#define COMMON_LVB_GRID_LVERTICAL 0x0800
-#endif
-
-#ifndef COMMON_LVB_GRID_RVERTICAL
-#define COMMON_LVB_GRID_RVERTICAL 0x1000
-#endif
-
-#ifndef COMMON_LVB_REVERSE_VIDEO
-#define COMMON_LVB_REVERSE_VIDEO 0x4000
-#endif
-
-#ifndef COMMON_LVB_UNDERSCORE
-#define COMMON_LVB_UNDERSCORE 0x8000
-#endif
-
-
class WindowsAttribute : public Attribute {
protected:
WORD wAttributes;
WindowsAttribute(WORD _wAttributes) : wAttributes(_wAttributes) {}
void apply(std::ostream& os) const {
DWORD nStdHandleOutput;
- if (os == std::cout) {
+ if (&os == &std::cout) {
nStdHandleOutput = STD_OUTPUT_HANDLE;
- } else if (os == std::cerr) {
+ } else if (&os == &std::cerr) {
nStdHandleOutput = STD_ERROR_HANDLE;
} else {
return;
}
};
-#endif
+
+#endif /* _WIN32 */
inline Formatter *defaultFormatter(bool color = true) {