summaryrefslogtreecommitdiff
path: root/thirdparty/etcpak/Debug.cpp
blob: 72dc4e0526809431741af2481d742ce85b7d8f27 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
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 );
    }
}