From b2c35cdf69a9084806ac7930cf4475980d596cf6 Mon Sep 17 00:00:00 2001 From: Roland Reichwein Date: Sat, 4 Jan 2025 11:28:20 +0100 Subject: Separate out implementation from headers --- debug.cpp | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'debug.cpp') 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& (*func) + (std::basic_ostream&) ) { + if (m_active) + std::cout << *func; + return *this; +} -- cgit v1.2.3