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

#include "CloneGenerator.h"

Inheritance diagram for ClassCloneGenerator:
Collaboration diagram for ClassCloneGenerator:

Public Member Functions

 ClassCloneGenerator (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 CloneGenerator.h.

Constructor & Destructor Documentation

ClassCloneGenerator::ClassCloneGenerator ( FILE *  outputFile = NULL)

Definition at line 29 of file CloneGenerator.cpp.

References RegisterProcessors().

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

Here is the call graph for this function:

Member Function Documentation

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

Implements Generator.

Definition at line 198 of file CloneGenerator.cpp.

References Generator::mOutputFile.

199 {
200  const char* name = field->Attribute( "name" );
201  if (name == nullptr) {
202  std::cout << std::endl << "ClassCloneGenerator::ProcessBool field at line " << field->Row() << " is missing the name attribute, skipping.";
203  return false;
204  }
205 
206  fprintf( mOutputFile,
207  " %s = oth.%s;\n"
208  "\n",
209  name, name
210  );
211 
212  return true;
213 }
FILE * mOutputFile
Definition: Generator.h:108
bool ClassCloneGenerator::ProcessBuffer ( const TiXmlElement *  field)
protectedvirtual

Implements Generator.

Definition at line 220 of file CloneGenerator.cpp.

References Generator::mOutputFile.

221 {
222  const char* name = field->Attribute( "name" );
223  if (name == nullptr) {
224  std::cout << std::endl << "ClassCloneGenerator::ProcessBuffer field at line " << field->Row() << " is missing the name attribute, skipping.";
225  return false;
226  }
227 
228  fprintf( mOutputFile,
229  " PySafeDecRef(%s);\n"
230  " if (oth.%s == nullptr) {\n"
231  " %s = nullptr;\n"
232  " _log(NET__PACKET_WARNING, \"oth.%s is null. %s = nullptr \");\n"
233  " } else\n"
234  " %s = new PyBuffer(*oth.%s);\n"
235  "\n",
236  name,
237  name,
238  name,
239  name, name,
240  name, name
241  );
242 
243  return true;
244 }
FILE * mOutputFile
Definition: Generator.h:108
bool ClassCloneGenerator::ProcessDict ( const TiXmlElement *  field)
protectedvirtual

Implements Generator.

Definition at line 495 of file CloneGenerator.cpp.

References Generator::mOutputFile.

496 {
497  const char* name = field->Attribute( "name" );
498  if (name == nullptr) {
499  std::cout << std::endl << "ClassCloneGenerator::ProcessDict field at line " << field->Row() << " is missing the name attribute, skipping.";
500  return false;
501  }
502 
503  fprintf(mOutputFile,
504  " PySafeDecRef(%s);\n"
505  " if (oth.%s == nullptr) {\n"
506  " %s = nullptr;\n"
507  " _log(NET__PACKET_WARNING, \"oth.%s is null. %s = nullptr \");\n"
508  " } else\n"
509  " %s = new PyDict(*oth.%s);\n"
510  "\n",
511  name,
512  name,
513  name,
514  name, name,
515 
516  name, name
517  );
518 
519  return true;
520 }
FILE * mOutputFile
Definition: Generator.h:108
bool ClassCloneGenerator::ProcessDictInline ( const TiXmlElement *  field)
protectedvirtual

Implements Generator.

Definition at line 522 of file CloneGenerator.cpp.

References XMLParser::ParseElementChildren().

523 {
524  return ParseElementChildren( field );
525 }
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 ClassCloneGenerator::ProcessDictInlineEntry ( const TiXmlElement *  field)
protected

Definition at line 527 of file CloneGenerator.cpp.

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

Referenced by RegisterProcessors().

528 {
529  //we dont really even care about this...
530  const char* key = field->Attribute( "key" );
531  if (key == nullptr) {
532  std::cout << std::endl << "ClassCloneGenerator::ProcessDictInlineEntry <dictInlineEntry> at line " << field->Row() << " is missing the key attribute, skipping.";
533  return false;
534  }
535 
536  return ParseElementChildren( field, 1 );
537 }
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 ClassCloneGenerator::ProcessDictInt ( const TiXmlElement *  field)
protectedvirtual

Implements Generator.

Definition at line 556 of file CloneGenerator.cpp.

References Generator::mOutputFile.

557 {
558  const char* name = field->Attribute( "name" );
559 
560  if (name == nullptr) {
561  std::cout << std::endl << "ClassCloneGenerator::ProcessDictInt field at line " << field->Row() << " is missing the name attribute, skipping.";
562  return false;
563  }
564 
565  fprintf( mOutputFile,
566  " std::map<int32, PyRep*>::const_iterator %s_cur = %s.begin();\n"
567  " //free any existing elements first\n"
568  " for (; %s_cur != %s.end(); %s_cur++)\n"
569  " PyDecRef( %s_cur->second );\n"
570  " %s.clear();\n"
571  "\n"
572  " //now we can copy in the new ones...\n"
573  " for (%s_cur = oth.%s.begin(); %s_cur != oth.%s.end(); %s_cur++)\n"
574  " %s[ %s_cur->first ] = %s_cur->second->Clone();\n"
575  "\n",
576  name, name,
577  name, name, name,
578  name,
579  name,
580  name, name, name, name, name,
581  name, name, name
582  );
583 
584  return true;
585 }
FILE * mOutputFile
Definition: Generator.h:108
bool ClassCloneGenerator::ProcessDictRaw ( const TiXmlElement *  field)
protectedvirtual

Implements Generator.

Definition at line 539 of file CloneGenerator.cpp.

References Generator::mOutputFile.

540 {
541  const char* name = field->Attribute( "name" );
542  if (name == nullptr) {
543  std::cout << std::endl << "ClassCloneGenerator::ProcessDictRaw field at line " << field->Row() << " is missing the name attribute, skipping.";
544  return false;
545  }
546 
547  fprintf( mOutputFile,
548  " %s = oth.%s;\n"
549  "\n",
550  name, name
551  );
552 
553  return true;
554 }
FILE * mOutputFile
Definition: Generator.h:108
bool ClassCloneGenerator::ProcessDictStr ( const TiXmlElement *  field)
protectedvirtual

Implements Generator.

Definition at line 587 of file CloneGenerator.cpp.

References Generator::mOutputFile.

588 {
589  const char* name = field->Attribute( "name" );
590  if (name == nullptr) {
591  std::cout << std::endl << "ClassCloneGenerator::ProcessDictStr field at line " << field->Row() << " is missing the name attribute, skipping.";
592  return false;
593  }
594 
595  fprintf( mOutputFile,
596  " std::map<std::string, PyRep*>::const_iterator %s_cur = %s.begin();\n"
597  " //free any existing elements first\n"
598  " for (; %s_cur != %s.end(); %s_cur++)\n"
599  " PyDecRef( %s_cur->second );\n"
600  " %s.clear();\n"
601  "\n"
602  " //now we can copy in the new ones...\n"
603  " for (%s_cur = oth.%s.begin(); %s_cur != oth.%s.end(); %s_cur++)\n"
604  " %s[ %s_cur->first ] = %s_cur->second->Clone();\n"
605  "\n",
606  name, name,
607  name, name, name,
608  name,
609  name,
610  name, name, name, name, name,
611  name, name, name
612  );
613 
614  return true;
615 }
FILE * mOutputFile
Definition: Generator.h:108
bool ClassCloneGenerator::ProcessElement ( const TiXmlElement *  field)
protectedvirtual

Implements Generator.

Definition at line 68 of file CloneGenerator.cpp.

References Generator::mOutputFile.

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

Implements Generator.

Definition at line 42 of file CloneGenerator.cpp.

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

43 {
44  const char* name = field->Attribute( "name" );
45  if (name == nullptr) {
46  std::cout << std::endl << "ClassCloneGenerator:: <element> at line " << field->Row() << " is missing the name attribute, skipping.";
47  return false;
48  }
49 
50  fprintf( mOutputFile,
51  "%s& %s::operator=( const %s& oth )\n"
52  "{\n",
53  name, name, name
54  );
55 
56  if( !ParseElementChildren( field ) )
57  return false;
58 
59  fprintf( mOutputFile,
60  " return *this;\n"
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 ClassCloneGenerator::ProcessElementPtr ( const TiXmlElement *  field)
protectedvirtual

Implements Generator.

Definition at line 90 of file CloneGenerator.cpp.

References Generator::mOutputFile.

91 {
92  const char* name = field->Attribute( "name" );
93  if (name == nullptr) {
94  std::cout << std::endl << "ClassCloneGenerator::ProcessElementPtr field at line " << field->Row() << " is missing the name attribute, skipping.";
95  return false;
96  }
97  const char* type = field->Attribute( "type" );
98  if (type == nullptr) {
99  std::cout << std::endl << "ClassCloneGenerator::ProcessElementPtr field at line " << field->Row() << " is missing the type attribute, skipping.";
100  return false;
101  }
102 
103  fprintf( mOutputFile,
104  " SafeDelete(%s);\n"
105  " if (oth.%s == nullptr) {\n"
106  " %s = nullptr;\n"
107  " _log(NET__PACKET_WARNING, \"oth.%s is null. %s = nullptr \");\n"
108  " } else\n"
109  " %s = new %s(*oth.%s);\n"
110  "\n",
111  name,
112  name,
113  name,
114  name, name,
115  name, type, name
116  );
117 
118  return true;
119 }
FILE * mOutputFile
Definition: Generator.h:108
bool ClassCloneGenerator::ProcessInt ( const TiXmlElement *  field)
protectedvirtual

Implements Generator.

Definition at line 147 of file CloneGenerator.cpp.

References Generator::mOutputFile.

148 {
149  const char* name = field->Attribute( "name" );
150  if (name == nullptr) {
151  std::cout << std::endl << "ClassCloneGenerator::ProcessInt field at line " << field->Row() << " is missing the name attribute, skipping.";
152  return false;
153  }
154 
155  fprintf( mOutputFile,
156  " %s = oth.%s;\n"
157  "\n",
158  name, name
159  );
160 
161  return true;
162 }
FILE * mOutputFile
Definition: Generator.h:108
bool ClassCloneGenerator::ProcessList ( const TiXmlElement *  field)
protectedvirtual

Implements Generator.

Definition at line 413 of file CloneGenerator.cpp.

References Generator::mOutputFile.

414 {
415  const char* name = field->Attribute( "name" );
416  if (name == nullptr) {
417  std::cout << std::endl << "ClassCloneGenerator::ProcessList field at line " << field->Row() << " is missing the name attribute, skipping.";
418  return false;
419  }
420 
421  fprintf( mOutputFile,
422  " PySafeDecRef(%s);\n"
423  " if (oth.%s == nullptr) {\n"
424  " %s = nullptr;\n"
425  " _log(NET__PACKET_WARNING, \"oth.%s is null. %s = nullptr \");\n"
426  " } else\n"
427  " %s = new PyList(*oth.%s);\n"
428  "\n",
429  name,
430  name,
431  name,
432  name, name,
433  name, name
434  );
435 
436  return true;
437 }
FILE * mOutputFile
Definition: Generator.h:108
bool ClassCloneGenerator::ProcessListInline ( const TiXmlElement *  field)
protectedvirtual

Implements Generator.

Definition at line 439 of file CloneGenerator.cpp.

References XMLParser::ParseElementChildren().

440 {
441  return ParseElementChildren( field );
442 }
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 ClassCloneGenerator::ProcessListInt ( const TiXmlElement *  field)
protectedvirtual

Implements Generator.

Definition at line 444 of file CloneGenerator.cpp.

References Generator::mOutputFile.

445 {
446  const char* name = field->Attribute( "name" );
447  if (name == nullptr) {
448  std::cout << std::endl << "ClassCloneGenerator::ProcessListInt field at line " << field->Row() << " is missing the name attribute, skipping.";
449  return false;
450  }
451 
452  fprintf( mOutputFile,
453  " %s = oth.%s;\n"
454  "\n",
455  name, name
456  );
457 
458  return true;
459 }
FILE * mOutputFile
Definition: Generator.h:108
bool ClassCloneGenerator::ProcessListLong ( const TiXmlElement *  field)
protectedvirtual

Implements Generator.

Definition at line 461 of file CloneGenerator.cpp.

References Generator::mOutputFile.

462 {
463  const char* name = field->Attribute( "name" );
464  if (name == nullptr) {
465  std::cout << std::endl << "ClassCloneGenerator::ProcessListLong field at line " << field->Row() << " is missing the name attribute, skipping.";
466  return false;
467  }
468 
469  fprintf( mOutputFile,
470  " %s = oth.%s;\n"
471  "\n",
472  name, name
473  );
474 
475  return true;
476 }
FILE * mOutputFile
Definition: Generator.h:108
bool ClassCloneGenerator::ProcessListStr ( const TiXmlElement *  field)
protectedvirtual

Implements Generator.

Definition at line 478 of file CloneGenerator.cpp.

References Generator::mOutputFile.

479 {
480  const char* name = field->Attribute( "name" );
481  if (name == nullptr) {
482  std::cout << std::endl << "ClassCloneGenerator::ProcessListStr field at line " << field->Row() << " is missing the name attribute, skipping.";
483  return false;
484  }
485 
486  fprintf( mOutputFile,
487  " %s = oth.%s;\n"
488  "\n",
489  name, name
490  );
491 
492  return true;
493 }
FILE * mOutputFile
Definition: Generator.h:108
bool ClassCloneGenerator::ProcessLong ( const TiXmlElement *  field)
protectedvirtual

Implements Generator.

Definition at line 164 of file CloneGenerator.cpp.

References Generator::mOutputFile.

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

Implements Generator.

Definition at line 215 of file CloneGenerator.cpp.

216 {
217  return true;
218 }
bool ClassCloneGenerator::ProcessObject ( const TiXmlElement *  field)
protectedvirtual

Implements Generator.

Definition at line 321 of file CloneGenerator.cpp.

References Generator::mOutputFile.

322 {
323  const char* name = field->Attribute( "name" );
324  if (name == nullptr) {
325  std::cout << std::endl << "ClassCloneGenerator::ProcessObject field at line " << field->Row() << " is missing the name attribute, skipping.";
326  return false;
327  }
328 
329  fprintf( mOutputFile,
330  " PySafeDecRef(%s);\n"
331  " if (oth.%s == nullptr) {\n"
332  " %s = nullptr;\n"
333  " _log(NET__PACKET_WARNING, \"oth.%s is null. %s = nullptr \");\n"
334  " } else\n"
335  " %s = new PyObject(*oth.%s);\n"
336  "\n",
337  name,
338  name,
339  name,
340  name, name,
341  name, name
342  );
343 
344  return true;
345 }
FILE * mOutputFile
Definition: Generator.h:108
bool ClassCloneGenerator::ProcessObjectEx ( const TiXmlElement *  field)
protectedvirtual

Implements Generator.

Definition at line 352 of file CloneGenerator.cpp.

References Generator::mOutputFile.

353 {
354  const char* name = field->Attribute( "name" );
355  if (name == nullptr) {
356  std::cout << std::endl << "ClassCloneGenerator::ProcessObjectEx field at line " << field->Row() << " is missing the name attribute, skipping.";
357  return false;
358  }
359  const char* type = field->Attribute( "type" );
360  if (type == nullptr) {
361  std::cout << std::endl << "ClassCloneGenerator::ProcessObjectEx field at line " << field->Row() << " is missing the type attribute, skipping.";
362  return false;
363  }
364 
365  fprintf( mOutputFile,
366  " PySafeDecRef(%s);\n"
367  " if (oth.%s == nullptr) {\n"
368  " %s = nullptr;\n"
369  " _log(NET__PACKET_WARNING, \"oth.%s is null. %s = nullptr \");\n"
370  " } else\n"
371  " %s = new %s(*oth.%s);\n",
372  name,
373  name,
374  name,
375  name, name,
376  name, type, name
377  );
378 
379  return true;
380 }
FILE * mOutputFile
Definition: Generator.h:108
bool ClassCloneGenerator::ProcessObjectInline ( const TiXmlElement *  field)
protectedvirtual

Implements Generator.

Definition at line 347 of file CloneGenerator.cpp.

References XMLParser::ParseElementChildren().

348 {
349  return ParseElementChildren( field, 2 );
350 }
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 ClassCloneGenerator::ProcessRaw ( const TiXmlElement *  field)
protectedvirtual

Implements Generator.

Definition at line 121 of file CloneGenerator.cpp.

References Generator::mOutputFile.

122 {
123  const char* name = field->Attribute( "name" );
124  if (name == nullptr) {
125  std::cout << std::endl << "ClassCloneGenerator::ProcessRaw field at line " << field->Row() << " is missing the name attribute, skipping.";
126  return false;
127  }
128 
129  fprintf( mOutputFile,
130  " PySafeDecRef(%s);\n"
131  " if (oth.%s == nullptr) {\n"
132  " %s = nullptr;\n"
133  " _log(NET__PACKET_WARNING, \"oth.%s is null. %s = nullptr \");\n"
134  " } else\n"
135  " %s = oth.%s->Clone();\n"
136  "\n",
137  name,
138  name,
139  name,
140  name, name,
141  name, name
142  );
143 
144  return true;
145 }
FILE * mOutputFile
Definition: Generator.h:108
bool ClassCloneGenerator::ProcessReal ( const TiXmlElement *  field)
protectedvirtual

Implements Generator.

Definition at line 181 of file CloneGenerator.cpp.

References Generator::mOutputFile.

182 {
183  const char* name = field->Attribute( "name" );
184  if (name == nullptr) {
185  std::cout << std::endl << "ClassCloneGenerator::ProcessReal field at line " << field->Row() << " is missing the name attribute, skipping.";
186  return false;
187  }
188 
189  fprintf( mOutputFile,
190  " %s = oth.%s;\n"
191  "\n",
192  name, name
193  );
194 
195  return true;
196 }
FILE * mOutputFile
Definition: Generator.h:108
bool ClassCloneGenerator::ProcessString ( const TiXmlElement *  field)
protectedvirtual

Implements Generator.

Definition at line 246 of file CloneGenerator.cpp.

References Generator::mOutputFile.

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

Implements Generator.

Definition at line 263 of file CloneGenerator.cpp.

264 {
265  return true;
266 }
bool ClassCloneGenerator::ProcessSubStreamInline ( const TiXmlElement *  field)
protectedvirtual

Implements Generator.

Definition at line 617 of file CloneGenerator.cpp.

References XMLParser::ParseElementChildren().

618 {
619  return ParseElementChildren( field, 1 );
620 }
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 ClassCloneGenerator::ProcessSubStructInline ( const TiXmlElement *  field)
protectedvirtual

Implements Generator.

Definition at line 622 of file CloneGenerator.cpp.

References XMLParser::ParseElementChildren().

623 {
624  return ParseElementChildren( field, 1 );
625 }
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 ClassCloneGenerator::ProcessToken ( const TiXmlElement *  field)
protectedvirtual

Implements Generator.

Definition at line 290 of file CloneGenerator.cpp.

References Generator::mOutputFile.

291 {
292  const char* name = field->Attribute( "name" );
293  if (name == nullptr) {
294  std::cout << std::endl << "ClassCloneGenerator::ProcessToken field at line " << field->Row() << " is missing the name attribute, skipping.";
295  return false;
296  }
297 
298  fprintf( mOutputFile,
299  " PySafeDecRef(%s);\n"
300  " if (oth.%s == nullptr) {\n"
301  " %s = nullptr;\n"
302  " _log(NET__PACKET_WARNING, \"oth.%s is null. %s = nullptr \");\n"
303  " } else\n"
304  " %s = oth.%s->Clone();\n"
305  "\n",
306  name,
307  name,
308  name,
309  name, name,
310  name, name
311  );
312 
313  return true;
314 }
FILE * mOutputFile
Definition: Generator.h:108
bool ClassCloneGenerator::ProcessTokenInline ( const TiXmlElement *  field)
protectedvirtual

Implements Generator.

Definition at line 316 of file CloneGenerator.cpp.

317 {
318  return true;
319 }
bool ClassCloneGenerator::ProcessTuple ( const TiXmlElement *  field)
protectedvirtual

Implements Generator.

Definition at line 382 of file CloneGenerator.cpp.

References Generator::mOutputFile.

383 {
384  const char* name = field->Attribute( "name" );
385  if (name == nullptr) {
386  std::cout << std::endl << "ClassCloneGenerator::ProcessTuple field at line " << field->Row() << " is missing the name attribute, skipping.";
387  return false;
388  }
389 
390  fprintf( mOutputFile,
391  " PySafeDecRef(%s);\n"
392  " if (oth.%s == nullptr) {\n"
393  " %s = nullptr;\n"
394  " _log(NET__PACKET_WARNING, \"oth.%s is null. %s = nullptr \");\n"
395  " } else\n"
396  " %s = new PyTuple(*oth.%s);\n"
397  "\n",
398  name,
399  name,
400  name,
401  name, name,
402  name, name
403  );
404 
405  return true;
406 }
FILE * mOutputFile
Definition: Generator.h:108
bool ClassCloneGenerator::ProcessTupleInline ( const TiXmlElement *  field)
protectedvirtual

Implements Generator.

Definition at line 408 of file CloneGenerator.cpp.

References XMLParser::ParseElementChildren().

409 {
410  return ParseElementChildren( field );
411 }
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 ClassCloneGenerator::ProcessWString ( const TiXmlElement *  field)
protectedvirtual

Implements Generator.

Definition at line 268 of file CloneGenerator.cpp.

References Generator::mOutputFile.

269 {
270  const char* name = field->Attribute( "name" );
271  if (name == nullptr) {
272  std::cout << std::endl << "ClassCloneGenerator::ProcessWString field at line " << field->Row() << " is missing the name attribute, skipping.";
273  return false;
274  }
275 
276  fprintf( mOutputFile,
277  " %s = oth.%s;\n"
278  "\n",
279  name, name
280  );
281 
282  return true;
283 }
FILE * mOutputFile
Definition: Generator.h:108
bool ClassCloneGenerator::ProcessWStringInline ( const TiXmlElement *  field)
protectedvirtual

Implements Generator.

Definition at line 285 of file CloneGenerator.cpp.

286 {
287  return true;
288 }
void ClassCloneGenerator::RegisterProcessors ( )
protected

Definition at line 35 of file CloneGenerator.cpp.

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

Referenced by ClassCloneGenerator().

36 {
38 
40 }
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: