summaryrefslogtreecommitdiff
path: root/thirdparty/etcpak/Debug.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'thirdparty/etcpak/Debug.cpp')
-rw-r--r--thirdparty/etcpak/Debug.cpp31
1 files changed, 31 insertions, 0 deletions
diff --git a/thirdparty/etcpak/Debug.cpp b/thirdparty/etcpak/Debug.cpp
new file mode 100644
index 0000000000..72dc4e0526
--- /dev/null
+++ b/thirdparty/etcpak/Debug.cpp
@@ -0,0 +1,31 @@
+#include <algorithm>
+#include <vector>
+#include "Debug.hpp"
+
+static std::vector<DebugLog::Callback*> s_callbacks;
+
+void DebugLog::Message( const char* msg )
+{
+ for( auto it = s_callbacks.begin(); it != s_callbacks.end(); ++it )
+ {
+ (*it)->OnDebugMessage( msg );
+ }
+}
+
+void DebugLog::AddCallback( Callback* c )
+{
+ const auto it = std::find( s_callbacks.begin(), s_callbacks.end(), c );
+ if( it == s_callbacks.end() )
+ {
+ s_callbacks.push_back( c );
+ }
+}
+
+void DebugLog::RemoveCallback( Callback* c )
+{
+ const auto it = std::find( s_callbacks.begin(), s_callbacks.end(), c );
+ if( it != s_callbacks.end() )
+ {
+ s_callbacks.erase( it );
+ }
+}