summaryrefslogtreecommitdiffhomepage
path: root/debug.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'debug.cpp')
-rw-r--r--debug.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/debug.cpp b/debug.cpp
index 09c9fcc..096c894 100644
--- a/debug.cpp
+++ b/debug.cpp
@@ -1,3 +1,23 @@
#include "debug.h"
debug_ostream debug_cout;
+
+debug_ostream::debug_ostream(): m_active(false) {}
+
+void debug_ostream::activate()
+{
+ m_active = true;
+}
+
+void debug_ostream::deactivate()
+{
+ m_active = false;
+}
+
+debug_ostream& debug_ostream::operator<<(
+ std::basic_ostream<char>& (*func)
+ (std::basic_ostream<char>&) ) {
+ if (m_active)
+ std::cout << *func;
+ return *this;
+}