Richard Boegli's CnC_Generals_Zero_Hour Fork WIP
This is documentation of Richard Boegil's Zero Hour Fork
 
Loading...
Searching...
No Matches
debug_io.h
Go to the documentation of this file.
1/*
2** Command & Conquer Generals Zero Hour(tm)
3** Copyright 2025 Electronic Arts Inc.
4**
5** This program is free software: you can redistribute it and/or modify
6** it under the terms of the GNU General Public License as published by
7** the Free Software Foundation, either version 3 of the License, or
8** (at your option) any later version.
9**
10** This program is distributed in the hope that it will be useful,
11** but WITHOUT ANY WARRANTY; without even the implied warranty of
12** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13** GNU General Public License for more details.
14**
15** You should have received a copy of the GNU General Public License
16** along with this program. If not, see <http://www.gnu.org/licenses/>.
17*/
18
20// $File: //depot/GeneralsMD/Staging/code/Libraries/Source/debug/debug_io.h $
21// $Author: mhoffe $
22// $Revision: #1 $
23// $DateTime: 2003/07/03 11:55:26 $
24//
25// ©2003 Electronic Arts
26//
27// Debug I/O interface
29#ifdef _MSC_VER
30# pragma once
31#endif
32#ifndef DEBUG_IO_H // Include guard
33#define DEBUG_IO_H
34
46class DebugIOInterface
47{
48 // no copy/assign op
49 DebugIOInterface(const &DebugIOInterface);
50 DebugIOInterface& operator=(const DebugIOInterface&);
51
52protected:
59 virtual ~DebugIOInterface() {}
60
61public:
62 // interface only so no functionality here
63 explicit DebugIOInterface(void) {}
64
94
106 virtual int Read(char *buf, int maxchar)=0;
107
127 virtual void Write(StringType type, const char *src, const char *str)=0;
128
135 virtual void EmergencyFlush(void)=0;
136
150 virtual void Execute(class Debug& dbg, const char *cmd, bool structuredCmd,
151 unsigned argn, const char * const * argv)=0;
152
158 virtual void Delete(void)=0;
159};
160
165
166#ifdef DOXYGEN
167
175 #define DEBUG_DECLARE_IO_INTERFACE(type)
176
186 #define DEBUG_IMPLEMENT_IO_INTERFACE(io_id,descr,type)
187
188#else
189
190 #define DEBUG_DECLARE_IO_INTERFACE(type) \
191 public: \
192 static bool __RegisterClassFactory; \
193 static DebugIOInterface *__ClassFactory(void) { return new type; }
194
195 #define DEBUG_IMPLEMENT_IO_INTERFACE(io_id,descr,type) \
196 static bool type::__RegisterClassFactory=Debug::AddIOFactory(#io_id,descr,type::__ClassFactory);
197
198#endif
199
201
202#endif // DEBUG_IO_H
Debug module main class (singleton).
Definition debug_debug.h:45
DebugIOInterface(void)
Definition debug_io.h:63
virtual ~DebugIOInterface()
I/O class destructor.
Definition debug_io.h:59
virtual void Write(StringType type, const char *src, const char *str)=0
Write out some characters differentiated by the log string type.
StringType
List of possible log string types.
Definition debug_io.h:67
@ Other
some other message
Definition debug_io.h:90
@ Check
DCHECK etc.
Definition debug_io.h:72
@ CmdReply
Regular command reply.
Definition debug_io.h:84
@ Crash
DCRASH etc.
Definition debug_io.h:78
@ Exception
Exception.
Definition debug_io.h:81
@ Log
DLOG etc.
Definition debug_io.h:75
@ Assert
DASSERT etc.
Definition debug_io.h:69
@ StructuredCmdReply
Structured command reply, see Structured command reply.
Definition debug_io.h:87
virtual void EmergencyFlush(void)=0
Emergency shutdown function.
virtual int Read(char *buf, int maxchar)=0
Retrieves up to the given number of characters from a command input source.
virtual void Delete(void)=0
Destroys the current I/O class instance.
virtual void Execute(class Debug &dbg, const char *cmd, bool structuredCmd, unsigned argn, const char *const *argv)=0
I/O class specific command.