Richard Boegli's CnC_Generals_Zero_Hour Fork WIP
This is documentation of Richard Boegil's Zero Hour Fork
 
Loading...
Searching...
No Matches
errclass.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
19/* $Header: /Commando/Code/Tools/pluglib/errclass.h 5 6/25/99 10:46a Greg_h $ */
20/***********************************************************************************************
21 *** Confidential - Westwood Studios ***
22 ***********************************************************************************************
23 * *
24 * Project Name : Commando Tools - W3D export *
25 * *
26 * $Archive:: /Commando/Code/Tools/pluglib/errclass.h $*
27 * *
28 * $Author:: Greg_h $*
29 * *
30 * $Modtime:: 6/24/99 3:38p $*
31 * *
32 * $Revision:: 5 $*
33 * *
34 *---------------------------------------------------------------------------------------------*
35 * Functions: *
36 * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
37
38#ifndef ERRCLASS_H
39#define ERRCLASS_H
40
41#include <stdarg.h>
42
43
45{
46public:
47 ErrorClass(char * format,...);
48 ErrorClass(const ErrorClass & that);
50
51 ErrorClass & operator = (const ErrorClass & that);
52
54};
55
56inline ErrorClass::ErrorClass(char * format,...)
57{
58 va_list va;
59 char tmp[1024];
60 va_start(va,format);
61 vsprintf(tmp,format,va);
62 assert(strlen(tmp) < 1024);
63 va_end(va);
64 error_message = strdup(tmp);
65}
66
67inline ErrorClass::ErrorClass(const ErrorClass & that) :
69{
70 *this = that;
71}
72
74{
75 if (error_message != NULL) {
76 free(error_message);
78 }
79
80 if (that.error_message != NULL) {
81 error_message = strdup(that.error_message);
82 }
83
84 return *this;
85}
86
87
88#endif //ERRCLASS_H
#define NULL
Definition BaseType.h:92
~ErrorClass(void)
Definition errclass.h:49
ErrorClass(char *format,...)
Definition errclass.h:56
char * error_message
Definition errclass.h:53
ErrorClass & operator=(const ErrorClass &that)
Definition errclass.h:73