EvEmu  0.8.4
11 September 2021
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
ClassDestructGenerator Class Reference

#include "DestructGenerator.h"

Inheritance diagram for ClassDestructGenerator:
Collaboration diagram for ClassDestructGenerator:

Public Member Functions

 ClassDestructGenerator (FILE *outputFile=NULL)
 
- Public Member Functions inherited from Generator
 Generator (FILE *outputFile=NULL)
 Primary constructor. More...
 
void SetOutputFile (FILE *outputFile)
 Sets output file. More...
 
- Public Member Functions inherited from XMLParserEx
template<typename T >
void AddMemberParser (const char *name, T &instance, bool(T::*method)(const TiXmlElement *))
 Adds a member parser. More...
 
template<typename T >
void AddValueParser (const char *name, T &value)
 Adds a value parser. More...
 
- Public Member Functions inherited from XMLParser
 XMLParser ()
 Primary constructor. More...
 
virtual ~XMLParser ()
 A destructor. More...
 
bool ParseFile (const char *file)
 Parses file using registered parsers. More...
 
bool ParseElement (const TiXmlElement *element) const
 Parses element using registered parsers. More...
 
bool ParseElementChildren (const TiXmlElement *element, size_t max=0) const
 Parses element's children using registered parsers. More...
 
void AddParser (const char *name, ElementParser *parser)
 Adds a parser. More...
 
void RemoveParser (const char *name)
 Removes a parser. More...
 
void ClearParsers ()
 Clears all parsers. More...
 

Protected Member Functions

void RegisterProcessors ()
 
bool ProcessElementDef (const TiXmlElement *field)
 
bool ProcessElement (const TiXmlElement *field)
 
bool ProcessElementPtr (const TiXmlElement *field)
 
bool ProcessRaw (const TiXmlElement *field)
 
bool ProcessInt (const TiXmlElement *field)
 
bool ProcessLong (const TiXmlElement *field)
 
bool ProcessReal (const TiXmlElement *field)
 
bool ProcessBool (const TiXmlElement *field)
 
bool ProcessNone (const TiXmlElement *field)
 
bool ProcessBuffer (const TiXmlElement *field)
 
bool ProcessString (const TiXmlElement *field)
 
bool ProcessStringInline (const TiXmlElement *field)
 
bool ProcessWString (const TiXmlElement *field)
 
bool ProcessWStringInline (const TiXmlElement *field)
 
bool ProcessToken (const TiXmlElement *field)
 
bool ProcessTokenInline (const TiXmlElement *field)
 
bool ProcessObject (const TiXmlElement *field)
 
bool ProcessObjectInline (const TiXmlElement *field)
 
bool ProcessObjectEx (const TiXmlElement *field)
 
bool ProcessTuple (const TiXmlElement *field)
 
bool ProcessTupleInline (const TiXmlElement *field)
 
bool ProcessList (const TiXmlElement *field)
 
bool ProcessListInline (const TiXmlElement *field)
 
bool ProcessListInt (const TiXmlElement *field)
 
bool ProcessListLong (const TiXmlElement *field)
 
bool ProcessListStr (const TiXmlElement *field)
 
bool ProcessDict (const TiXmlElement *field)
 
bool ProcessDictInline (const TiXmlElement *field)
 
bool ProcessDictInlineEntry (const TiXmlElement *field)
 
bool ProcessDictRaw (const TiXmlElement *field)
 
bool ProcessDictInt (const TiXmlElement *field)
 
bool ProcessDictStr (const TiXmlElement *field)
 
bool ProcessSubStreamInline (const TiXmlElement *field)
 
bool ProcessSubStructInline (const TiXmlElement *field)
 
- Protected Member Functions inherited from Generator
void RegisterProcessors ()
 
- Protected Member Functions inherited from XMLParserEx
template<typename T >
void AddMemberParser (const char *name, bool(T::*method)(const TiXmlElement *))
 Adds a member parser, assuming that instance is this. More...
 

Additional Inherited Members

- Public Attributes inherited from XMLParser
std::unique_ptr< TiXmlDocument > m_pXML_Document
 
- Static Protected Member Functions inherited from Generator
static const char * GetEncodeType (const TiXmlElement *element)
 Obtains encode type of given element. More...
 
- Protected Attributes inherited from Generator
FILE * mOutputFile
 

Detailed Description

Definition at line 31 of file DestructGenerator.h.

Constructor & Destructor Documentation

ClassDestructGenerator::ClassDestructGenerator ( FILE *  outputFile = NULL)

Definition at line 30 of file DestructGenerator.cpp.

References RegisterProcessors().

31 : Generator( outputFile )
32 {
34 }
Generator(FILE *outputFile=NULL)
Primary constructor.
Definition: Generator.cpp:38

Here is the call graph for this function:

Member Function Documentation

bool ClassDestructGenerator::ProcessBool ( const TiXmlElement *  field)
protectedvirtual

Implements Generator.

Definition at line 120 of file DestructGenerator.cpp.

121 {
122  return true;
123 }
bool ClassDestructGenerator::ProcessBuffer ( const TiXmlElement *  field)
protectedvirtual

Implements Generator.

Definition at line 130 of file DestructGenerator.cpp.

References Generator::mOutputFile.

131 {
132  const char* name = field->Attribute( "name" );
133  if (name == nullptr) {
134  std::cout << std::endl << "ClassDestructGenerator:: field at line " << field->Row() << " is missing the name attribute, skipping.";
135  return false;
136  }
137 
138  fprintf( mOutputFile,
139  " //PySafeDecRef( %s );\n",
140  name
141  );
142 
143  return true;
144 }
FILE * mOutputFile
Definition: Generator.h:108
bool ClassDestructGenerator::ProcessDict ( const TiXmlElement *  field)
protectedvirtual

Implements Generator.

Definition at line 281 of file DestructGenerator.cpp.

References Generator::mOutputFile.

282 {
283  const char* name = field->Attribute( "name" );
284  if (name == nullptr) {
285  std::cout << std::endl << "ClassDestructGenerator:: field at line " << field->Row() << " is missing the name attribute, skipping.";
286  return false;
287  }
288 
289  fprintf( mOutputFile,
290  " //PySafeDecRef( %s );\n",
291  name
292  );
293 
294  return true;
295 }
FILE * mOutputFile
Definition: Generator.h:108
bool ClassDestructGenerator::ProcessDictInline ( const TiXmlElement *  field)
protectedvirtual

Implements Generator.

Definition at line 297 of file DestructGenerator.cpp.

References XMLParser::ParseElementChildren().

298 {
299  return ParseElementChildren( field );
300 }
bool ParseElementChildren(const TiXmlElement *element, size_t max=0) const
Parses element's children using registered parsers.
Definition: XMLParser.cpp:72

Here is the call graph for this function:

bool ClassDestructGenerator::ProcessDictInlineEntry ( const TiXmlElement *  field)
protected

Definition at line 302 of file DestructGenerator.cpp.

References key(), and XMLParser::ParseElementChildren().

Referenced by RegisterProcessors().

303 {
304  //we dont really even care about this...
305  const char* key = field->Attribute( "key" );
306  if (key == nullptr) {
307  std::cout << std::endl << "ClassDestructGenerator:: <dictInlineEntry> at line " << field->Row() << " is missing the key attribute, skipping.";
308  return false;
309  }
310 
311  return ParseElementChildren( field, 1 );
312 }
bool ParseElementChildren(const TiXmlElement *element, size_t max=0) const
Parses element's children using registered parsers.
Definition: XMLParser.cpp:72
typeID Spawn an NPC with the specified type text Search for items matching the specified query() type() key(value)-Send an OnRemoteMessage" ) COMMAND( setbpattr

Here is the call graph for this function:

Here is the caller graph for this function:

bool ClassDestructGenerator::ProcessDictInt ( const TiXmlElement *  field)
protectedvirtual

Implements Generator.

Definition at line 319 of file DestructGenerator.cpp.

References Generator::mOutputFile.

320 {
321  const char* name = field->Attribute( "name" );
322  if (name == nullptr) {
323  std::cout << std::endl << "ClassDestructGenerator:: field at line " << field->Row() << " is missing the name attribute, skipping.";
324  return false;
325  }
326 
327  fprintf( mOutputFile,
328  " std::map<int32, PyRep*>::const_iterator %s_cur = %s.begin();\n"
329  " for (; %s_cur != %s.end(); %s_cur++)\n"
330  " PyDecRef( %s_cur->second );\n"
331  "\n",
332  name, name,
333  name, name, name,
334  name
335  );
336 
337  return true;
338 }
FILE * mOutputFile
Definition: Generator.h:108
bool ClassDestructGenerator::ProcessDictRaw ( const TiXmlElement *  field)
protectedvirtual

Implements Generator.

Definition at line 314 of file DestructGenerator.cpp.

315 {
316  return true;
317 }
bool ClassDestructGenerator::ProcessDictStr ( const TiXmlElement *  field)
protectedvirtual

Implements Generator.

Definition at line 340 of file DestructGenerator.cpp.

References Generator::mOutputFile.

341 {
342  const char* name = field->Attribute( "name" );
343  if (name == nullptr) {
344  std::cout << std::endl << "ClassDestructGenerator:: field at line " << field->Row() << " is missing the name attribute, skipping.";
345  return false;
346  }
347 
348  fprintf( mOutputFile,
349  " std::map<std::string, PyRep*>::const_iterator %s_cur = %s.begin();\n"
350  " for (; %s_cur != %s.end(); %s_cur++)\n"
351  " PyDecRef( %s_cur->second );\n"
352  "\n",
353  name, name,
354  name, name, name,
355  name
356  );
357 
358  return true;
359 }
FILE * mOutputFile
Definition: Generator.h:108
bool ClassDestructGenerator::ProcessElement ( const TiXmlElement *  field)
protectedvirtual

Implements Generator.

Definition at line 68 of file DestructGenerator.cpp.

69 {
70  return true;
71 }
bool ClassDestructGenerator::ProcessElementDef ( const TiXmlElement *  field)
protectedvirtual

Implements Generator.

Definition at line 43 of file DestructGenerator.cpp.

References Generator::mOutputFile, and XMLParser::ParseElementChildren().

44 {
45  const char* name = field->Attribute( "name" );
46  if (name == nullptr) {
47  std::cout << std::endl << "ClassDestructGenerator:: <element> at line " << field->Row() << " is missing the name attribute, skipping.";
48  return false;
49  }
50 
51  fprintf( mOutputFile,
52  "%s::~%s()\n"
53  "{\n",
54  name, name
55  );
56 
57  if( !ParseElementChildren( field ) )
58  return false;
59 
60  fprintf( mOutputFile,
61  "}\n"
62  "\n"
63  );
64 
65  return true;
66 }
FILE * mOutputFile
Definition: Generator.h:108
bool ParseElementChildren(const TiXmlElement *element, size_t max=0) const
Parses element's children using registered parsers.
Definition: XMLParser.cpp:72

Here is the call graph for this function:

bool ClassDestructGenerator::ProcessElementPtr ( const TiXmlElement *  field)
protectedvirtual

Implements Generator.

Definition at line 73 of file DestructGenerator.cpp.

References Generator::mOutputFile.

74 {
75  const char* name = field->Attribute( "name" );
76  if (name == nullptr) {
77  std::cout << std::endl << "ClassDestructGenerator:: field at line " << field->Row() << " is missing the name attribute, skipping.";
78  return false;
79  }
80 
81  fprintf( mOutputFile,
82  " SafeDelete( %s );\n",
83  name
84  );
85 
86  return true;
87 }
FILE * mOutputFile
Definition: Generator.h:108
bool ClassDestructGenerator::ProcessInt ( const TiXmlElement *  field)
protectedvirtual

Implements Generator.

Definition at line 105 of file DestructGenerator.cpp.

106 {
107  return true;
108 }
bool ClassDestructGenerator::ProcessList ( const TiXmlElement *  field)
protectedvirtual

Implements Generator.

Definition at line 246 of file DestructGenerator.cpp.

References Generator::mOutputFile.

247 {
248  const char* name = field->Attribute( "name" );
249  if (name == nullptr) {
250  std::cout << std::endl << "ClassDestructGenerator:: field at line " << field->Row() << " is missing the name attribute, skipping.";
251  return false;
252  }
253 
254  fprintf( mOutputFile,
255  " //PySafeDecRef( %s );\n",
256  name
257  );
258 
259  return true;
260 }
FILE * mOutputFile
Definition: Generator.h:108
bool ClassDestructGenerator::ProcessListInline ( const TiXmlElement *  field)
protectedvirtual

Implements Generator.

Definition at line 262 of file DestructGenerator.cpp.

References XMLParser::ParseElementChildren().

263 {
264  return ParseElementChildren( field );
265 }
bool ParseElementChildren(const TiXmlElement *element, size_t max=0) const
Parses element's children using registered parsers.
Definition: XMLParser.cpp:72

Here is the call graph for this function:

bool ClassDestructGenerator::ProcessListInt ( const TiXmlElement *  field)
protectedvirtual

Implements Generator.

Definition at line 267 of file DestructGenerator.cpp.

268 {
269  return true;
270 }
bool ClassDestructGenerator::ProcessListLong ( const TiXmlElement *  field)
protectedvirtual

Implements Generator.

Definition at line 272 of file DestructGenerator.cpp.

273 {
274  return true;
275 }
bool ClassDestructGenerator::ProcessListStr ( const TiXmlElement *  field)
protectedvirtual

Implements Generator.

Definition at line 277 of file DestructGenerator.cpp.

277  {
278  return true;
279 }
bool ClassDestructGenerator::ProcessLong ( const TiXmlElement *  field)
protectedvirtual

Implements Generator.

Definition at line 110 of file DestructGenerator.cpp.

111 {
112  return true;
113 }
bool ClassDestructGenerator::ProcessNone ( const TiXmlElement *  field)
protectedvirtual

Implements Generator.

Definition at line 125 of file DestructGenerator.cpp.

126 {
127  return true;
128 }
bool ClassDestructGenerator::ProcessObject ( const TiXmlElement *  field)
protectedvirtual

Implements Generator.

Definition at line 187 of file DestructGenerator.cpp.

References Generator::mOutputFile.

188 {
189  const char* name = field->Attribute( "name" );
190  if (name == nullptr) {
191  std::cout << std::endl << "ClassDestructGenerator:: field at line " << field->Row() << " is missing the name attribute, skipping.";
192  return false;
193  }
194 
195  fprintf( mOutputFile,
196  " //PySafeDecRef( %s );\n"
197  "\n",
198  name
199  );
200 
201  return true;
202 }
FILE * mOutputFile
Definition: Generator.h:108
bool ClassDestructGenerator::ProcessObjectEx ( const TiXmlElement *  field)
protectedvirtual

Implements Generator.

Definition at line 209 of file DestructGenerator.cpp.

References Generator::mOutputFile.

210 {
211  const char* name = field->Attribute( "name" );
212  if (name == nullptr) {
213  std::cout << std::endl << "ClassDestructGenerator:: field at line " << field->Row() << " is missing the name attribute, skipping.";
214  return false;
215  }
216 
217  fprintf( mOutputFile,
218  " //PySafeDecRef( %s );\n",
219  name
220  );
221 
222  return true;
223 }
FILE * mOutputFile
Definition: Generator.h:108
bool ClassDestructGenerator::ProcessObjectInline ( const TiXmlElement *  field)
protectedvirtual

Implements Generator.

Definition at line 204 of file DestructGenerator.cpp.

References XMLParser::ParseElementChildren().

205 {
206  return ParseElementChildren( field, 2 );
207 }
bool ParseElementChildren(const TiXmlElement *element, size_t max=0) const
Parses element's children using registered parsers.
Definition: XMLParser.cpp:72

Here is the call graph for this function:

bool ClassDestructGenerator::ProcessRaw ( const TiXmlElement *  field)
protectedvirtual

Implements Generator.

Definition at line 89 of file DestructGenerator.cpp.

References Generator::mOutputFile.

90 {
91  const char* name = field->Attribute( "name" );
92  if (name == nullptr) {
93  std::cout << std::endl << "ClassDestructGenerator:: field at line " << field->Row() << " is missing the name attribute, skipping.";
94  return false;
95  }
96 
97  fprintf( mOutputFile,
98  " PySafeDecRef( %s );\n",
99  name
100  );
101 
102  return true;
103 }
FILE * mOutputFile
Definition: Generator.h:108
bool ClassDestructGenerator::ProcessReal ( const TiXmlElement *  field)
protectedvirtual

Implements Generator.

Definition at line 115 of file DestructGenerator.cpp.

116 {
117  return true;
118 }
bool ClassDestructGenerator::ProcessString ( const TiXmlElement *  field)
protectedvirtual

Implements Generator.

Definition at line 146 of file DestructGenerator.cpp.

147 {
148  return true;
149 }
bool ClassDestructGenerator::ProcessStringInline ( const TiXmlElement *  field)
protectedvirtual

Implements Generator.

Definition at line 151 of file DestructGenerator.cpp.

152 {
153  return true;
154 }
bool ClassDestructGenerator::ProcessSubStreamInline ( const TiXmlElement *  field)
protectedvirtual

Implements Generator.

Definition at line 361 of file DestructGenerator.cpp.

References XMLParser::ParseElementChildren().

362 {
363  return ParseElementChildren( field, 1 );
364 }
bool ParseElementChildren(const TiXmlElement *element, size_t max=0) const
Parses element's children using registered parsers.
Definition: XMLParser.cpp:72

Here is the call graph for this function:

bool ClassDestructGenerator::ProcessSubStructInline ( const TiXmlElement *  field)
protectedvirtual

Implements Generator.

Definition at line 366 of file DestructGenerator.cpp.

References XMLParser::ParseElementChildren().

367 {
368  return ParseElementChildren( field, 1 );
369 }
bool ParseElementChildren(const TiXmlElement *element, size_t max=0) const
Parses element's children using registered parsers.
Definition: XMLParser.cpp:72

Here is the call graph for this function:

bool ClassDestructGenerator::ProcessToken ( const TiXmlElement *  field)
protectedvirtual

Implements Generator.

Definition at line 166 of file DestructGenerator.cpp.

References Generator::mOutputFile.

167 {
168  const char* name = field->Attribute( "name" );
169  if (name == nullptr) {
170  std::cout << std::endl << "ClassDestructGenerator:: field at line " << field->Row() << " is missing the name attribute, skipping.";
171  return false;
172  }
173 
174  fprintf( mOutputFile,
175  " //PySafeDecRef( %s );\n",
176  name
177  );
178 
179  return true;
180 }
FILE * mOutputFile
Definition: Generator.h:108
bool ClassDestructGenerator::ProcessTokenInline ( const TiXmlElement *  field)
protectedvirtual

Implements Generator.

Definition at line 182 of file DestructGenerator.cpp.

183 {
184  return true;
185 }
bool ClassDestructGenerator::ProcessTuple ( const TiXmlElement *  field)
protectedvirtual

Implements Generator.

Definition at line 225 of file DestructGenerator.cpp.

References Generator::mOutputFile.

226 {
227  const char* name = field->Attribute( "name" );
228  if (name == nullptr) {
229  std::cout << std::endl << "ClassDestructGenerator:: field at line " << field->Row() << " is missing the name attribute, skipping.";
230  return false;
231  }
232 
233  fprintf( mOutputFile,
234  " //PySafeDecRef( %s );\n",
235  name
236  );
237 
238  return true;
239 }
FILE * mOutputFile
Definition: Generator.h:108
bool ClassDestructGenerator::ProcessTupleInline ( const TiXmlElement *  field)
protectedvirtual

Implements Generator.

Definition at line 241 of file DestructGenerator.cpp.

References XMLParser::ParseElementChildren().

242 {
243  return ParseElementChildren( field );
244 }
bool ParseElementChildren(const TiXmlElement *element, size_t max=0) const
Parses element's children using registered parsers.
Definition: XMLParser.cpp:72

Here is the call graph for this function:

bool ClassDestructGenerator::ProcessWString ( const TiXmlElement *  field)
protectedvirtual

Implements Generator.

Definition at line 156 of file DestructGenerator.cpp.

157 {
158  return true;
159 }
bool ClassDestructGenerator::ProcessWStringInline ( const TiXmlElement *  field)
protectedvirtual

Implements Generator.

Definition at line 161 of file DestructGenerator.cpp.

162 {
163  return true;
164 }
void ClassDestructGenerator::RegisterProcessors ( )
protected

Definition at line 36 of file DestructGenerator.cpp.

References XMLParserEx::AddMemberParser(), ProcessDictInlineEntry(), and Generator::RegisterProcessors().

Referenced by ClassDestructGenerator().

37 {
39 
41 }
void RegisterProcessors()
Definition: Generator.cpp:44
bool ProcessDictInlineEntry(const TiXmlElement *field)
void AddMemberParser(const char *name, T &instance, bool(T::*method)(const TiXmlElement *))
Adds a member parser.
Definition: XMLParserEx.h:55

Here is the call graph for this function:

Here is the caller graph for this function:


The documentation for this class was generated from the following files: