ScummVM API documentation
debug-channels.h
1/* ScummVM - Graphic Adventure Engine
2 *
3 * ScummVM is the legal property of its developers, whose names
4 * are too numerous to list here. Please refer to the COPYRIGHT
5 * file distributed with this source distribution.
6 *
7 * This program is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
19 *
20 */
21
22#ifndef COMMON_DEBUG_CHANNELS_H
23#define COMMON_DEBUG_CHANNELS_H
24
25#include "common/scummsys.h"
26
27#include "common/hashmap.h"
28#include "common/hash-str.h"
29#include "common/list.h"
30#include "common/singleton.h"
31#include "common/str.h"
32
37 uint32 channel;
38 const char *name;
39 const char *description;
40};
41
45#define DEBUG_CHANNEL_END {0, NULL, NULL}
46
47extern const DebugChannelDef gDebugChannels[];
48
49namespace Common {
50
59// TODO: Find a better name for this
60class DebugManager : public Singleton<DebugManager> {
61public:
62
63 struct DebugChannel {
64 DebugChannel() : channel(0) {}
65 DebugChannel(uint32 c, const String &n, const String &d)
66 : name(n), description(d), channel(c) {}
67
71 uint32 channel;
72 };
73
97 bool addDebugChannel(uint32 channel, const String &name, const String &description);
98
104
109
116 bool enableDebugChannel(const String &name);
117
124 bool enableDebugChannel(uint32 channel);
125
132 bool disableDebugChannel(const String &name);
133
140 bool disableDebugChannel(uint32 channel);
141
143
151
156
161
165 bool isDebugChannelEnabled(uint32 channel, bool enforce = false);
166
167private:
170
171 DebugChannelMap _debugChannels;
172 EnabledChannelsMap _debugChannelsEnabled;
173 uint32 _globalChannelsMask;
174
175 friend class Singleton<SingletonBaseType>;
176
177 DebugManager();
178
182 void addDebugChannels(const DebugChannelDef *channels);
183};
184
186#define DebugMan Common::DebugManager::instance()
187
190} // End of namespace Common
191
192#endif
Definition: debug-channels.h:60
void addAllDebugChannels(const DebugChannelDef *channels)
bool disableDebugChannel(const String &name)
bool addDebugChannel(uint32 channel, const String &name, const String &description)
bool enableDebugChannel(uint32 channel)
DebugChannelList getDebugChannels()
bool enableDebugChannel(const String &name)
bool disableDebugChannel(uint32 channel)
void disableAllDebugChannels()
bool isDebugChannelEnabled(uint32 channel, bool enforce=false)
Definition: list.h:44
Definition: singleton.h:42
Definition: str.h:59
Definition: algorithm.h:29
Definition: debug-channels.h:63
uint32 channel
Definition: debug-channels.h:71
String name
Definition: debug-channels.h:68
String description
Definition: debug-channels.h:69
Definition: debug-channels.h:36
uint32 channel
Definition: debug-channels.h:37
const char * name
Definition: debug-channels.h:38
const char * description
Definition: debug-channels.h:39