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

#include "EncodeGenerator.h"

Inheritance diagram for ClassEncodeGenerator:
Collaboration diagram for ClassEncodeGenerator:

Public Member Functions

 ClassEncodeGenerator (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

const char * top () const
 
void pop ()
 
void push (const char *v)
 
void clear ()
 
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 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...
 

Private Attributes

uint32 mItemNumber
 
std::stack< std::string > mVariableStack
 
const char * mName
 

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 EncodeGenerator.h.

Constructor & Destructor Documentation

ClassEncodeGenerator::ClassEncodeGenerator ( FILE *  outputFile = NULL)

Definition at line 30 of file EncodeGenerator.cpp.

References Generator::RegisterProcessors().

31 : Generator( outputFile ),
32  mItemNumber( 0 ),
33  mName( nullptr )
34 {
36 }
void RegisterProcessors()
Definition: Generator.cpp:44
Generator(FILE *outputFile=NULL)
Primary constructor.
Definition: Generator.cpp:38

Here is the call graph for this function:

Member Function Documentation

void ClassEncodeGenerator::clear ( )
inlineprotected

Definition at line 41 of file EncodeGenerator.h.

References mVariableStack, and pop().

Referenced by ProcessElementDef().

41 { while( !mVariableStack.empty() ) pop(); }
std::stack< std::string > mVariableStack

Here is the call graph for this function:

Here is the caller graph for this function:

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

Implements Generator.

Definition at line 234 of file EncodeGenerator.cpp.

References Generator::mOutputFile, pop(), and top().

235 {
236  const char* name = field->Attribute( "name" );
237  if (name == nullptr) {
238  std::cout << std::endl << "ClassEncodeGenerator:: field at line " << field->Row() << " is missing the name attribute, skipping.";
239  return false;
240  }
241 
242  fprintf( mOutputFile,
243  " %s = new PyBool( %s );\n",
244  top(), name
245  );
246 
247  pop();
248  return true;
249 }
const char * top() const
FILE * mOutputFile
Definition: Generator.h:108

Here is the call graph for this function:

bool ClassEncodeGenerator::ProcessBuffer ( const TiXmlElement *  field)
protectedvirtual

Implements Generator.

Definition at line 262 of file EncodeGenerator.cpp.

References mName, Generator::mOutputFile, pop(), and top().

263 {
264  const char* name = field->Attribute( "name" );
265  if (name == nullptr) {
266  std::cout << std::endl << "ClassEncodeGenerator:: field at line " << field->Row() << " is missing the name attribute, skipping.";
267  return false;
268  }
269 
270  const char* v = top();
271  fprintf( mOutputFile,
272  " if (%s != nullptr) {\n"
273  " %s = %s;\n"
274  " PyIncRef(%s);\n"
275  " } else {\n"
276  " _log(NET__PACKET_WARNING, \"Encode %s: %s is null. Encoding an empty buffer.\");\n"
277  " %s = new PyBuffer( 0 );\n"
278  " }\n"
279  "\n",
280  name,
281  v, name,
282  name,
283  mName, name,
284  v
285  );
286 
287  pop();
288  return true;
289 }
const char * top() const
FILE * mOutputFile
Definition: Generator.h:108

Here is the call graph for this function:

bool ClassEncodeGenerator::ProcessDict ( const TiXmlElement *  field)
protectedvirtual

Implements Generator.

Definition at line 838 of file EncodeGenerator.cpp.

References mName, Generator::mOutputFile, pop(), str2< bool >(), and top().

839 {
840  const char* name = field->Attribute( "name" );
841  if (name == nullptr) {
842  std::cout << std::endl << "ClassEncodeGenerator:: field at line " << field->Row() << " is missing the name attribute, skipping.";
843  return false;
844  }
845 
846  bool optional = false;
847  const char* optional_str = field->Attribute("optional");
848  if (optional_str != nullptr )
849  optional = str2<bool>( optional_str );
850 
851  const char* v = top();
852  fprintf( mOutputFile,
853  " if (%s == nullptr) {\n"
854  " _log(NET__PACKET_WARNING, \"Encode %s: %s is null. Encoding an empty dict.\");\n"
855  " %s = new PyDict();\n"
856  " } else\n",
857  name,
858  mName, name,
859  v
860  );
861 
862  if (optional)
863  fprintf( mOutputFile,
864  " if (%s->empty())\n"
865  " %s = PyStatic.NewNone();\n"
866  " else\n",
867  name,
868  v
869  );
870 
871  fprintf( mOutputFile,
872  " {\n"
873  " %s = %s;\n"
874  " PyIncRef(%s);\n"
875  " }\n"
876  "\n",
877  v, name,
878  name
879  );
880 
881  pop();
882  return true;
883 }
const char * top() const
FILE * mOutputFile
Definition: Generator.h:108
bool str2< bool >(const char *str)
Converts string to boolean.
Definition: str2conv.cpp:31

Here is the call graph for this function:

bool ClassEncodeGenerator::ProcessDictInline ( const TiXmlElement *  field)
protectedvirtual

Implements Generator.

Definition at line 885 of file EncodeGenerator.cpp.

References key(), mItemNumber, Generator::mOutputFile, XMLParser::ParseElementChildren(), pop(), push(), snprintf, and top().

886 {
887  //first, create the dict container
888  char iname[16];
889  snprintf( iname, sizeof( iname ), "dict%u", mItemNumber++ );
890 
891  fprintf( mOutputFile,
892  " PyDict* %s = new PyDict();\n",
893  iname
894  );
895 
896  //now we process each element, putting it into the dict:
897  const TiXmlNode* i = nullptr;
898 
899  uint32 count = 0;
900  while ((i = field->IterateChildren(i))) {
901  if (i->Type() == TiXmlNode::TINYXML_ELEMENT) {
902  const TiXmlElement* ele = i->ToElement();
903 
904  //we only handle dictInlineEntry elements
905  if (strcmp( ele->Value(), "dictInlineEntry" ) != 0 ) {
906  std::cout << std::endl << "ClassEncodeGenerator::ProcessDictInline non-dictInlineEntry in <dictInline> at line " << field->Row() << ", ignoring.";
907  continue;
908  }
909  const char* key = ele->Attribute( "key" );
910  if (key == nullptr) {
911  std::cout << std::endl << "ClassEncodeGenerator::ProcessDictInline <dictInlineEntry> at line " << field->Row() << " is missing the key attribute, skipping.";
912  return false;
913  }
914 
915  bool keyTypeInt = false, keyTypeLong = false;
916  const char* keyType = ele->Attribute( "key_type" );
917  if (keyType != nullptr) {
918  keyTypeInt = ( strcmp( keyType, "int" ) == 0 );
919  keyTypeLong = ( strcmp( keyType, "long" ) == 0 );
920  }
921 
922  char vname[32];
923  snprintf( vname, sizeof( vname ), "%s_%u", iname, count );
924  ++count;
925 
926  fprintf( mOutputFile,
927  " PyRep* %s(nullptr);\n",
928  vname
929  );
930  push( vname );
931 
932  //now process the data part, putting the value into `varname`
933  if (!ParseElementChildren( ele, 1 ) )
934  return false;
935 
936  //now store the result in the dict:
937  //taking the keyType into account
938  if (keyTypeInt )
939  fprintf( mOutputFile,
940  " %s->SetItem(new PyInt( %s ), %s);\n"
941  " PyIncRef(%s);\n",
942  iname, key, vname,
943  vname
944  );
945  else if (keyTypeLong )
946  fprintf( mOutputFile,
947  " %s->SetItem(new PyLong( %s ), %s);\n"
948  " PyIncRef(%s);\n",
949  iname, key, vname,
950  vname
951  );
952  else
953  fprintf( mOutputFile,
954  " %s->SetItemString(\"%s\", %s);\n"
955  " PyIncRef(%s);\n",
956  iname, key, vname,
957  vname
958  );
959  }
960  }
961 
962  fprintf( mOutputFile,
963  " %s = %s;\n"
964  "\n",
965  top(), iname
966  );
967 
968  pop();
969  return true;
970 }
const char * top() const
void push(const char *v)
FILE * mOutputFile
Definition: Generator.h:108
#define snprintf
Definition: eve-compat.h:184
unsigned __int32 uint32
Definition: eve-compat.h:50
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:

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

Implements Generator.

Definition at line 1019 of file EncodeGenerator.cpp.

References mItemNumber, Generator::mOutputFile, pop(), snprintf, and top().

1020 {
1021  const char* name = field->Attribute( "name" );
1022  if (name == nullptr) {
1023  std::cout << std::endl << "ClassEncodeGenerator::ProcessDictInt field at line " << field->Row() << " is missing the name attribute, skipping.";
1024  return false;
1025  }
1026 
1027  char iname[16];
1028  snprintf( iname, sizeof( iname ), "dict%u", mItemNumber++ );
1029 
1030  fprintf( mOutputFile,
1031  " PyDict* %s = new PyDict();\n"
1032  " for (auto cur : %s) {\n"
1033  " %s->SetItem(new PyInt(cur.first ), cur.second);\n"
1034  " PyIncRef(cur.second);\n"
1035  " }\n"
1036  "\n"
1037  " %s = %s;\n",
1038  iname,
1039  name,
1040  iname,
1041 
1042  top(), iname
1043  );
1044 
1045  pop();
1046  return true;
1047 }
const char * top() const
FILE * mOutputFile
Definition: Generator.h:108
#define snprintf
Definition: eve-compat.h:184

Here is the call graph for this function:

bool ClassEncodeGenerator::ProcessDictRaw ( const TiXmlElement *  field)
protectedvirtual

Implements Generator.

Definition at line 972 of file EncodeGenerator.cpp.

References key(), mItemNumber, Generator::mOutputFile, pop(), snprintf, and top().

973 {
974  const char* name = field->Attribute( "name" );
975  if (name == nullptr) {
976  std::cout << std::endl << "ClassEncodeGenerator::ProcessDictRaw field at line " << field->Row() << " is missing the name attribute, skipping.";
977  return false;
978  }
979  const char* key = field->Attribute( "key" );
980  if (key == nullptr) {
981  std::cout << std::endl << "ClassEncodeGenerator::ProcessDictRaw field at line " << field->Row() << " is missing the key attribute, skipping.";
982  return false;
983  }
984  const char* pykey = field->Attribute( "pykey" );
985  if (pykey == nullptr) {
986  std::cout << std::endl << "ClassEncodeGenerator::ProcessDictRaw field at line " << field->Row() << " is missing the pykey attribute, skipping.";
987  return false;
988  }
989  const char* value = field->Attribute( "value" );
990  if (value == nullptr) {
991  std::cout << std::endl << "ClassEncodeGenerator::ProcessDictRaw field at line " << field->Row() << " is missing the value attribute, skipping.";
992  return false;
993  }
994  const char* pyvalue = field->Attribute( "pyvalue" );
995  if (pyvalue == nullptr) {
996  std::cout << std::endl << "ClassEncodeGenerator::ProcessDictRaw field at line " << field->Row() << " is missing the pyvalue attribute, skipping.";
997  return false;
998  }
999 
1000  char rname[16];
1001  snprintf( rname, sizeof( rname ), "dict%u", mItemNumber++ );
1002 
1003  fprintf( mOutputFile,
1004  " PyDict* %s = new PyDict();\n"
1005  " for (auto cur : %s) \n"
1006  " %s->SetItem(new Py%s(cur.first), new Py%s(cur.second));\n"
1007  " %s = %s;\n"
1008  "\n",
1009  rname,
1010  name,
1011  rname, pykey, pyvalue,
1012  top(), rname
1013  );
1014 
1015  pop();
1016  return true;
1017 }
const char * top() const
FILE * mOutputFile
Definition: Generator.h:108
#define snprintf
Definition: eve-compat.h:184
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:

bool ClassEncodeGenerator::ProcessDictStr ( const TiXmlElement *  field)
protectedvirtual

Implements Generator.

Definition at line 1049 of file EncodeGenerator.cpp.

References mItemNumber, Generator::mOutputFile, pop(), snprintf, and top().

1050 {
1051  const char* name = field->Attribute( "name" );
1052  if (name == nullptr) {
1053  std::cout << std::endl << "ClassEncodeGenerator::ProcessDictStr field at line " << field->Row() << " is missing the name attribute, skipping.";
1054  return false;
1055  }
1056 
1057  char iname[16];
1058  snprintf( iname, sizeof( iname ), "dict%d", mItemNumber++ );
1059 
1060  fprintf( mOutputFile,
1061  " PyDict* %s = new PyDict();\n"
1062  " for (auto cur : %s) {\n"
1063  " %s->SetItemString(cur.first.c_str(), cur.second);\n"
1064  " PyIncRef(cur.second);\n"
1065  " }\n"
1066  "\n"
1067  " %s = %s;\n",
1068  iname,
1069  name,
1070  iname,
1071 
1072  top(), iname
1073  );
1074 
1075  pop();
1076  return true;
1077 }
const char * top() const
FILE * mOutputFile
Definition: Generator.h:108
#define snprintf
Definition: eve-compat.h:184

Here is the call graph for this function:

bool ClassEncodeGenerator::ProcessElement ( const TiXmlElement *  field)
protectedvirtual

Implements Generator.

Definition at line 78 of file EncodeGenerator.cpp.

References Generator::mOutputFile, pop(), and top().

79 {
80  const char* name = field->Attribute( "name" );
81  if (name == nullptr) {
82  std::cout << std::endl << "ClassEncodeGenerator:: field at line " << field->Row() << " is missing the name attribute, skipping.";
83  return false;
84  }
85 
86  fprintf( mOutputFile,
87  " %s = %s.Encode();\n"
88  "\n",
89  top(), name
90  );
91 
92  pop();
93  return true;
94 }
const char * top() const
FILE * mOutputFile
Definition: Generator.h:108

Here is the call graph for this function:

bool ClassEncodeGenerator::ProcessElementDef ( const TiXmlElement *  field)
protectedvirtual

Implements Generator.

Definition at line 38 of file EncodeGenerator.cpp.

References clear(), Generator::GetEncodeType(), main(), mItemNumber, mName, Generator::mOutputFile, XMLParser::ParseElement(), and push().

39 {
40  mName = field->Attribute( "name" );
41  if (mName == nullptr) {
42  std::cout << std::endl << "ClassEncodeGenerator:: <element> at line " << field->Row() << " is missing the name attribute, skipping.";
43  return false;
44  }
45 
46  const TiXmlElement* main = field->FirstChildElement();
47  if (main->NextSiblingElement() != nullptr) {
48  std::cout << std::endl << "ClassEncodeGenerator:: <element> at line " << field->Row() << " contains more than one root element, skipping.";
49  return false;
50  }
51 
52  const char* encode_type = GetEncodeType( main );
53  fprintf( mOutputFile,
54  "%s* %s::Encode() const\n"
55  "{\n"
56  " %s* res(nullptr);\n"
57  "\n",
58  encode_type, mName,
59  encode_type
60  );
61 
62  mItemNumber = 0;
63  clear();
64 
65  push( "res" );
66  if (!ParseElement( main ) )
67  return false;
68 
69  fprintf( mOutputFile,
70  " return res;\n"
71  "}\n"
72  "\n"
73  );
74 
75  return true;
76 }
bool ParseElement(const TiXmlElement *element) const
Parses element using registered parsers.
Definition: XMLParser.cpp:61
void push(const char *v)
FILE * mOutputFile
Definition: Generator.h:108
static const char * GetEncodeType(const TiXmlElement *element)
Obtains encode type of given element.
Definition: Generator.cpp:86
int main(int argc, char *argv[])

Here is the call graph for this function:

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

Implements Generator.

Definition at line 96 of file EncodeGenerator.cpp.

References mName, Generator::mOutputFile, pop(), and top().

97 {
98  const char* name = field->Attribute( "name" );
99  if (name == nullptr) {
100  std::cout << std::endl << "ClassEncodeGenerator:: field at line " << field->Row() << " is missing the name attribute, skipping.";
101  return false;
102  }
103 
104  const char* v = top();
105  fprintf( mOutputFile,
106  " if (%s != nullptr)\n"
107  " %s = %s->Encode();\n"
108  " else {\n"
109  " _log(NET__PACKET_WARNING, \"Encode %s: %s is null. Encoding a PyNone\");\n"
110  " %s = PyStatic.NewNone();\n"
111  " }\n"
112  "\n",
113  name, v, name,
114  mName, name, v
115  );
116 
117  pop();
118  return true;
119 }
const char * top() const
FILE * mOutputFile
Definition: Generator.h:108

Here is the call graph for this function:

bool ClassEncodeGenerator::ProcessInt ( const TiXmlElement *  field)
protectedvirtual

Implements Generator.

Definition at line 150 of file EncodeGenerator.cpp.

References Generator::mOutputFile, pop(), and top().

151 {
152  const char* name = field->Attribute( "name" );
153  if (name == nullptr) {
154  std::cout << std::endl << "ClassEncodeGenerator:: field at line " << field->Row() << " is missing the name attribute, skipping.";
155  return false;
156  }
157 
158  const char* none_marker = field->Attribute( "none_marker" );
159  const char* v = top();
160  if (none_marker != nullptr)
161  fprintf(mOutputFile,
162  " if (%s == %s )\n"
163  " %s = PyStatic.NewNone();\n"
164  " else\n",
165  name, none_marker,
166  v
167  );
168 
169  fprintf(mOutputFile,
170  " %s = new PyInt( %s );\n",
171  v, name
172  );
173 
174  pop();
175  return true;
176 }
const char * top() const
FILE * mOutputFile
Definition: Generator.h:108

Here is the call graph for this function:

bool ClassEncodeGenerator::ProcessList ( const TiXmlElement *  field)
protectedvirtual

Implements Generator.

Definition at line 671 of file EncodeGenerator.cpp.

References mName, Generator::mOutputFile, pop(), str2< bool >(), and top().

672 {
673  const char* name = field->Attribute( "name" );
674  if (name == nullptr) {
675  std::cout << std::endl << "ClassEncodeGenerator::ProcessList field at line " << field->Row() << " is missing the name attribute, skipping.";
676  return false;
677  }
678 
679  bool optional = false;
680  const char* optional_str = field->Attribute( "optional" );
681  if (optional_str != nullptr )
682  optional = str2<bool>( optional_str );
683 
684  const char* v = top();
685  fprintf( mOutputFile,
686  " if (%s == nullptr) {\n"
687  " _log(NET__PACKET_WARNING, \"Encode %s: %s is null. Encoding an empty list.\");\n"
688  " %s = new PyList();\n"
689  " } else\n",
690  name,
691  mName, name,
692  v
693  );
694 
695  if (optional)
696  fprintf( mOutputFile,
697  " if (%s->empty())\n"
698  " %s = PyStatic.NewNone();\n"
699  " else\n",
700  name,
701  v
702  );
703 
704  fprintf( mOutputFile,
705  " {\n"
706  " %s = %s;\n"
707  " PyIncRef(%s);\n"
708  " }\n"
709  "\n",
710  v, name,
711  name
712  );
713 
714  pop();
715  return true;
716 }
const char * top() const
FILE * mOutputFile
Definition: Generator.h:108
bool str2< bool >(const char *str)
Converts string to boolean.
Definition: str2conv.cpp:31

Here is the call graph for this function:

bool ClassEncodeGenerator::ProcessListInline ( const TiXmlElement *  field)
protectedvirtual

Implements Generator.

Definition at line 718 of file EncodeGenerator.cpp.

References mItemNumber, Generator::mOutputFile, XMLParser::ParseElementChildren(), pop(), push(), snprintf, and top().

719 {
720  //first, we need to know how many elements this tuple has:
721  const TiXmlNode* i = nullptr;
722 
723  uint32 count = 0;
724  while( ( i = field->IterateChildren( i ) ) )
725  {
726  if (i->Type() == TiXmlNode::TINYXML_ELEMENT )
727  count++;
728  }
729 
730  char iname[16];
731  snprintf( iname, sizeof( iname ), "list%u", mItemNumber++ );
732 
733  //now we can generate the list decl
734  fprintf( mOutputFile,
735  " PyList* %s = new PyList( %u );\n",
736  iname, count
737  );
738 
739  //now we need to queue up all the storage locations for the fields
740  //need to be backward
741  char varname[64];
742  while( count-- > 0 )
743  {
744  snprintf( varname, sizeof( varname ), "%s->items[ %u ]", iname, count );
745  push( varname );
746  }
747 
748  if (!ParseElementChildren( field ))
749  return false;
750 
751  fprintf( mOutputFile,
752  " %s = %s;\n"
753  "\n",
754  top(), iname
755  );
756 
757  pop();
758  return true;
759 }
const char * top() const
void push(const char *v)
FILE * mOutputFile
Definition: Generator.h:108
#define snprintf
Definition: eve-compat.h:184
unsigned __int32 uint32
Definition: eve-compat.h:50
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 ClassEncodeGenerator::ProcessListInt ( const TiXmlElement *  field)
protectedvirtual

Implements Generator.

Definition at line 761 of file EncodeGenerator.cpp.

References mItemNumber, Generator::mOutputFile, pop(), snprintf, and top().

762 {
763  const char* name = field->Attribute( "name" );
764  if (name == nullptr) {
765  std::cout << std::endl << "ClassEncodeGenerator:: field at line " << field->Row() << " is missing the name attribute, skipping.";
766  return false;
767  }
768 
769  char rname[16];
770  snprintf( rname, sizeof( rname ), "list%u", mItemNumber++ );
771 
772  fprintf( mOutputFile,
773  " PyList* %s = new PyList();\n"
774  " for (auto cur : %s)\n"
775  " %s->AddItemInt(cur);\n"
776  " %s = %s;\n"
777  "\n",
778  rname, name, rname,
779  top(), rname
780  );
781 
782  pop();
783  return true;
784 }
const char * top() const
FILE * mOutputFile
Definition: Generator.h:108
#define snprintf
Definition: eve-compat.h:184

Here is the call graph for this function:

bool ClassEncodeGenerator::ProcessListLong ( const TiXmlElement *  field)
protectedvirtual

Implements Generator.

Definition at line 786 of file EncodeGenerator.cpp.

References mItemNumber, Generator::mOutputFile, pop(), snprintf, and top().

787 {
788  const char* name = field->Attribute( "name" );
789  if (name == nullptr) {
790  std::cout << std::endl << "ClassEncodeGenerator:: field at line " << field->Row() << " is missing the name attribute, skipping.";
791  return false;
792  }
793 
794  char rname[16];
795  snprintf( rname, sizeof( rname ), "list%u", mItemNumber++ );
796 
797  fprintf( mOutputFile,
798  " PyList *%s = new PyList();\n"
799  " for (auto cur : %s)\n"
800  " %s->AddItemLong(cur);\n"
801  " %s = %s;\n"
802  "\n",
803  rname, name,
804  rname,
805  top(), rname
806  );
807 
808  pop();
809  return true;
810 }
const char * top() const
FILE * mOutputFile
Definition: Generator.h:108
#define snprintf
Definition: eve-compat.h:184

Here is the call graph for this function:

bool ClassEncodeGenerator::ProcessListStr ( const TiXmlElement *  field)
protectedvirtual

Implements Generator.

Definition at line 812 of file EncodeGenerator.cpp.

References mItemNumber, Generator::mOutputFile, pop(), snprintf, and top().

813 {
814  const char* name = field->Attribute( "name" );
815  if (name == nullptr) {
816  std::cout << std::endl << "ClassEncodeGenerator:: field at line " << field->Row() << " is missing the name attribute, skipping.";
817  return false;
818  }
819 
820  char rname[16];
821  snprintf( rname, sizeof( rname ), "list%u", mItemNumber++ );
822 
823  fprintf( mOutputFile,
824  " PyList *%s = new PyList();\n"
825  " for (auto cur : %s)\n"
826  " %s->AddItemString(cur.c_str());\n"
827  " %s = %s;\n"
828  "\n",
829  rname, name,
830  rname,
831  top(), rname
832  );
833 
834  pop();
835  return true;
836 }
const char * top() const
FILE * mOutputFile
Definition: Generator.h:108
#define snprintf
Definition: eve-compat.h:184

Here is the call graph for this function:

bool ClassEncodeGenerator::ProcessLong ( const TiXmlElement *  field)
protectedvirtual

Implements Generator.

Definition at line 178 of file EncodeGenerator.cpp.

References Generator::mOutputFile, pop(), and top().

179 {
180  const char* name = field->Attribute( "name" );
181  if (name == nullptr) {
182  std::cout << std::endl << "ClassEncodeGenerator:: field at line " << field->Row() << " is missing the name attribute, skipping.";
183  return false;
184  }
185 
186  const char* none_marker = field->Attribute( "none_marker" );
187  const char* v = top();
188  if (none_marker != nullptr )
189  fprintf( mOutputFile,
190  " if (%s == %s )\n"
191  " %s = PyStatic.NewNone();\n"
192  " else\n",
193  name, none_marker,
194  v
195  );
196 
197  fprintf( mOutputFile,
198  " %s = new PyLong( %s );\n",
199  v, name
200  );
201 
202  pop();
203  return true;
204 }
const char * top() const
FILE * mOutputFile
Definition: Generator.h:108

Here is the call graph for this function:

bool ClassEncodeGenerator::ProcessNone ( const TiXmlElement *  field)
protectedvirtual

Implements Generator.

Definition at line 251 of file EncodeGenerator.cpp.

References Generator::mOutputFile, pop(), and top().

252 {
253  fprintf( mOutputFile,
254  " %s = PyStatic.NewNone();\n",
255  top()
256  );
257 
258  pop();
259  return true;
260 }
const char * top() const
FILE * mOutputFile
Definition: Generator.h:108

Here is the call graph for this function:

bool ClassEncodeGenerator::ProcessObject ( const TiXmlElement *  field)
protectedvirtual

Implements Generator.

Definition at line 447 of file EncodeGenerator.cpp.

References mName, Generator::mOutputFile, pop(), str2< bool >(), and top().

448 {
449  const char* name = field->Attribute( "name" );
450  if (name == nullptr) {
451  std::cout << std::endl << "ClassEncodeGenerator::ProcessObject field at line " << field->Row() << " is missing the name attribute, skipping.";
452  return false;
453  }
454 
455  bool optional = false;
456  const char* optional_str = field->Attribute( "optional" );
457  if (optional_str != nullptr )
458  optional = str2<bool>( optional_str );
459 
460  const char* v = top();
461  if (optional)
462  fprintf( mOutputFile,
463  " if (%s == nullptr)\n"
464  " %s = PyStatic.NewNone();\n"
465  " else\n",
466  name,
467  v
468  );
469  else
470  fprintf( mOutputFile,
471  " if (%s == nullptr) {\n"
472  " _log(NET__PACKET_WARNING, \"Encode %s: %s is null. Encoding a PyNone\");\n"
473  " %s = PyStatic.NewNone();\n"
474  " } else\n",
475  name,
476  mName, name,
477  v
478  );
479 
480  fprintf( mOutputFile,
481  " {\n"
482  " %s = %s;\n"
483  " PyIncRef(%s);\n"
484  " }\n"
485  "\n",
486  v, name,
487  name
488  );
489 
490  pop();
491  return true;
492 }
const char * top() const
FILE * mOutputFile
Definition: Generator.h:108
bool str2< bool >(const char *str)
Converts string to boolean.
Definition: str2conv.cpp:31

Here is the call graph for this function:

bool ClassEncodeGenerator::ProcessObjectEx ( const TiXmlElement *  field)
protectedvirtual

Implements Generator.

Definition at line 528 of file EncodeGenerator.cpp.

References mName, Generator::mOutputFile, pop(), str2< bool >(), and top().

529 {
530  const char* name = field->Attribute( "name" );
531  if (name == nullptr) {
532  std::cout << std::endl << "ClassEncodeGenerator::ProcessObjectEx field at line " << field->Row() << " is missing the name attribute, skipping.";
533  return false;
534  }
535  const char* type = field->Attribute( "type" );
536  if (type == nullptr) {
537  std::cout << std::endl << "ClassEncodeGenerator::ProcessObjectEx field at line " << field->Row() << " is missing the type attribute, skipping.";
538  return false;
539  }
540 
541  bool optional = false;
542  const char* optional_str = field->Attribute( "optional" );
543  if (optional_str != nullptr)
544  optional = str2<bool>( optional_str );
545 
546  const char *v = top();
547  if (optional)
548  fprintf( mOutputFile,
549  " if (%s == nullptr)\n"
550  " %s = PyStatic.NewNone();\n"
551  " else\n",
552  name,
553  v
554  );
555  else
556  fprintf( mOutputFile,
557  " if (%s == nullptr) {\n"
558  " _log(NET__PACKET_WARNING, \"Encode %s: %s is null. Encoding a PyNone\");\n"
559  " %s = PyStatic.NewNone();\n"
560  " } else\n",
561  name,
562  mName, name,
563  v
564  );
565 
566  fprintf( mOutputFile,
567  " {\n"
568  " %s = %s;\n"
569  " PyIncRef(%s);\n"
570  " }\n"
571  "\n",
572  v, name,
573  name
574  );
575 
576  pop();
577  return true;
578 }
const char * top() const
FILE * mOutputFile
Definition: Generator.h:108
bool str2< bool >(const char *str)
Converts string to boolean.
Definition: str2conv.cpp:31

Here is the call graph for this function:

bool ClassEncodeGenerator::ProcessObjectInline ( const TiXmlElement *  field)
protectedvirtual

Implements Generator.

Definition at line 494 of file EncodeGenerator.cpp.

References mItemNumber, Generator::mOutputFile, XMLParser::ParseElementChildren(), pop(), push(), snprintf, and top().

495 {
496  const uint32 num = mItemNumber++;
497 
498  char tname[32];
499  snprintf( tname, sizeof( tname ), "obj%u_type", num );
500 
501  char aname[32];
502  snprintf( aname, sizeof( aname ), "obj%u_args", num );
503 
504  fprintf( mOutputFile,
505  " PyString* %s(nullptr);\n"
506  " PyRep* %s(nullptr);\n"
507  "\n",
508  tname,
509  aname
510  );
511 
512  push( aname );
513  push( tname );
514 
515  if (!ParseElementChildren( field, 2 ) )
516  return false;
517 
518  const char* v = top();
519  fprintf( mOutputFile,
520  " %s = new PyObject(%s, %s);\n",
521  v, tname, aname
522  );
523 
524  pop();
525  return true;
526 }
const char * top() const
void push(const char *v)
FILE * mOutputFile
Definition: Generator.h:108
#define snprintf
Definition: eve-compat.h:184
unsigned __int32 uint32
Definition: eve-compat.h:50
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 ClassEncodeGenerator::ProcessRaw ( const TiXmlElement *  field)
protectedvirtual

Implements Generator.

Definition at line 121 of file EncodeGenerator.cpp.

References mName, Generator::mOutputFile, pop(), and top().

122 {
123  const char* name = field->Attribute( "name" );
124  if (name == nullptr) {
125  std::cout << std::endl << "ClassEncodeGenerator:: field at line " << field->Row() << " is missing the name attribute, skipping.";
126  return false;
127  }
128 
129  const char* v = top();
130  fprintf( mOutputFile,
131  " if (%s != nullptr) {\n"
132  " %s = %s;\n"
133  " PyIncRef(%s);\n"
134  " } else {\n"
135  " _log(NET__PACKET_WARNING, \"Encode %s: %s is null. Encoding a PyNone\");\n"
136  " %s = PyStatic.NewNone();\n"
137  " }\n"
138  "\n",
139  name,
140  v, name,
141  name,
142  mName, name,
143  v
144  );
145 
146  pop();
147  return true;
148 }
const char * top() const
FILE * mOutputFile
Definition: Generator.h:108

Here is the call graph for this function:

bool ClassEncodeGenerator::ProcessReal ( const TiXmlElement *  field)
protectedvirtual

Implements Generator.

Definition at line 206 of file EncodeGenerator.cpp.

References Generator::mOutputFile, pop(), and top().

207 {
208  const char* name = field->Attribute( "name" );
209  if (name == nullptr) {
210  std::cout << std::endl << "ClassEncodeGenerator:: field at line " << field->Row() << " is missing the name attribute, skipping.";
211  return false;
212  }
213 
214  const char* none_marker = field->Attribute( "none_marker" );
215  const char* v = top();
216  if (none_marker != nullptr )
217  fprintf( mOutputFile,
218  " if (%s == %s )\n"
219  " %s = PyStatic.NewNone();\n"
220  " else\n",
221  name, none_marker,
222  v
223  );
224 
225  fprintf( mOutputFile,
226  " %s = new PyFloat( %s );\n",
227  v, name
228  );
229 
230  pop();
231  return true;
232 }
const char * top() const
FILE * mOutputFile
Definition: Generator.h:108

Here is the call graph for this function:

bool ClassEncodeGenerator::ProcessString ( const TiXmlElement *  field)
protectedvirtual

Implements Generator.

Definition at line 291 of file EncodeGenerator.cpp.

References Generator::mOutputFile, pop(), and top().

292 {
293  const char* name = field->Attribute( "name" );
294  if (name == nullptr) {
295  std::cout << std::endl << "ClassEncodeGenerator:: field at line " << field->Row() << " is missing the name attribute, skipping.";
296  return false;
297  }
298 
299  const char* none_marker = field->Attribute( "none_marker" );
300  const char* v = top();
301  if (none_marker != nullptr )
302  fprintf( mOutputFile,
303  " if (%s == \"%s\" )\n"
304  " %s = PyStatic.NewNone();\n"
305  " else\n",
306  name, none_marker,
307  v
308  );
309 
310  fprintf( mOutputFile,
311  " %s = new PyString( %s );\n",
312  v, name
313  );
314 
315  pop();
316  return true;
317 }
const char * top() const
FILE * mOutputFile
Definition: Generator.h:108

Here is the call graph for this function:

bool ClassEncodeGenerator::ProcessStringInline ( const TiXmlElement *  field)
protectedvirtual

Implements Generator.

Definition at line 319 of file EncodeGenerator.cpp.

References Generator::mOutputFile, pop(), and top().

320 {
321  const char* value = field->Attribute( "value" );
322  if (value == nullptr) {
323  std::cout << std::endl << "ClassEncodeGenerator:: String element at line " << field->Row() << " has no value attribute, skipping.";
324  return false;
325  }
326 
327  const char* v = top();
328  fprintf( mOutputFile,
329  " %s = new PyString( \"%s\" );\n",
330  v, value
331  );
332 
333  pop();
334  return true;
335 }
const char * top() const
FILE * mOutputFile
Definition: Generator.h:108

Here is the call graph for this function:

bool ClassEncodeGenerator::ProcessSubStreamInline ( const TiXmlElement *  field)
protectedvirtual

Implements Generator.

Definition at line 1079 of file EncodeGenerator.cpp.

References mItemNumber, Generator::mOutputFile, XMLParser::ParseElementChildren(), pop(), push(), snprintf, and top().

1080 {
1081  char varname[16];
1082  snprintf( varname, sizeof( varname ), "ss_%d", mItemNumber++ );
1083 
1084  //encode the sub-element into a temp
1085  fprintf( mOutputFile,
1086  " PyRep* %s;\n",
1087  varname
1088  );
1089 
1090  push( varname );
1091  if (!ParseElementChildren( field, 1 ) )
1092  return false;
1093 
1094  //now make a substream from the temp at store it where it is needed
1095  fprintf( mOutputFile,
1096  " %s = new PySubStream( %s );\n",
1097  top(), varname
1098  );
1099 
1100  pop();
1101  return true;
1102 }
const char * top() const
void push(const char *v)
FILE * mOutputFile
Definition: Generator.h:108
#define snprintf
Definition: eve-compat.h:184
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 ClassEncodeGenerator::ProcessSubStructInline ( const TiXmlElement *  field)
protectedvirtual

Implements Generator.

Definition at line 1104 of file EncodeGenerator.cpp.

References mItemNumber, Generator::mOutputFile, XMLParser::ParseElementChildren(), pop(), push(), snprintf, and top().

1105 {
1106  char varname[16];
1107  snprintf( varname, sizeof( varname ), "ss_%d", mItemNumber++ );
1108 
1109  //encode the sub-element into a temp
1110  fprintf( mOutputFile,
1111  " PyRep* %s;\n",
1112  varname
1113  );
1114 
1115  push( varname );
1116  if (!ParseElementChildren( field, 1 ) )
1117  return false;
1118 
1119  //now make a substream from the temp at store it where it is needed
1120  fprintf( mOutputFile,
1121  " %s = new PySubStruct( %s );\n",
1122  top(), varname
1123  );
1124 
1125  pop();
1126  return true;
1127 }
const char * top() const
void push(const char *v)
FILE * mOutputFile
Definition: Generator.h:108
#define snprintf
Definition: eve-compat.h:184
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 ClassEncodeGenerator::ProcessToken ( const TiXmlElement *  field)
protectedvirtual

Implements Generator.

Definition at line 382 of file EncodeGenerator.cpp.

References mName, Generator::mOutputFile, pop(), str2< bool >(), and top().

383 {
384  const char* name = field->Attribute( "name" );
385  if (name == nullptr) {
386  std::cout << std::endl << "ClassEncodeGenerator:: field at line " << field->Row() << " is missing the name attribute, skipping.";
387  return false;
388  }
389 
390  bool optional = false;
391  const char* optional_str = field->Attribute("optional");
392  if (optional_str != nullptr )
393  optional = str2<bool>( optional_str );
394 
395  const char* v = top();
396  if (optional)
397  fprintf( mOutputFile,
398  " if (%s == nullptr)\n"
399  " %s = PyStatic.NewNone();\n"
400  " else\n",
401  name,
402  v
403  );
404  else
405  fprintf( mOutputFile,
406  " if (%s == nullptr) {\n"
407  " _log(NET__PACKET_WARNING, \"Encode %s: %s is null. Encoding a PyNone\");\n"
408  " %s = PyStatic.NewNone();\n"
409  " } else\n",
410  name,
411  mName, name,
412  v
413  );
414 
415  fprintf( mOutputFile,
416  " {\n"
417  " %s = %s;\n"
418  " PyIncRef(%s);\n"
419  " }\n"
420  "\n",
421  v, name,
422  name
423  );
424 
425  pop();
426  return true;
427 }
const char * top() const
FILE * mOutputFile
Definition: Generator.h:108
bool str2< bool >(const char *str)
Converts string to boolean.
Definition: str2conv.cpp:31

Here is the call graph for this function:

bool ClassEncodeGenerator::ProcessTokenInline ( const TiXmlElement *  field)
protectedvirtual

Implements Generator.

Definition at line 429 of file EncodeGenerator.cpp.

References Generator::mOutputFile, pop(), and top().

430 {
431  const char* value = field->Attribute( "value" );
432  if (value == nullptr) {
433  std::cout << std::endl << "ClassEncodeGenerator:: Token element at line " << field->Row() << " has no type attribute, skipping.";
434  return false;
435  }
436 
437  const char* v = top();
438  fprintf( mOutputFile,
439  " %s = new PyToken( \"%s\" );\n",
440  v, value
441  );
442 
443  pop();
444  return true;
445 }
const char * top() const
FILE * mOutputFile
Definition: Generator.h:108

Here is the call graph for this function:

bool ClassEncodeGenerator::ProcessTuple ( const TiXmlElement *  field)
protectedvirtual

Implements Generator.

Definition at line 580 of file EncodeGenerator.cpp.

References mName, Generator::mOutputFile, pop(), str2< bool >(), and top().

581 {
582  const char* name = field->Attribute( "name" );
583  if (name == nullptr) {
584  std::cout << std::endl << "ClassEncodeGenerator::ProcessTuple field at line " << field->Row() << " is missing the name attribute, skipping.";
585  return false;
586  }
587 
588  bool optional = false;
589  const char* optional_str = field->Attribute("optional");
590  if (optional_str != nullptr )
591  optional = str2<bool>( optional_str );
592 
593  const char* v = top();
594  fprintf( mOutputFile,
595  " if (%s == nullptr) {\n"
596  " _log(NET__PACKET_WARNING, \"Encode %s: %s is null. Encoding an empty tuple.\");\n"
597  " %s = new PyTuple( 0 );\n"
598  " } else\n",
599  name,
600  mName, name,
601  v
602  );
603 
604  if (optional)
605  fprintf( mOutputFile,
606  " if (%s->empty())\n"
607  " %s = PyStatic.NewNone();\n"
608  " else\n",
609  name,
610  v
611  );
612 
613  fprintf( mOutputFile,
614  " {\n"
615  " %s = %s;\n"
616  " PyIncRef(%s);\n"
617  " }\n"
618  "\n",
619  v, name,
620  name
621  );
622 
623  pop();
624  return true;
625 }
const char * top() const
FILE * mOutputFile
Definition: Generator.h:108
bool str2< bool >(const char *str)
Converts string to boolean.
Definition: str2conv.cpp:31

Here is the call graph for this function:

bool ClassEncodeGenerator::ProcessTupleInline ( const TiXmlElement *  field)
protectedvirtual

Implements Generator.

Definition at line 627 of file EncodeGenerator.cpp.

References mItemNumber, Generator::mOutputFile, XMLParser::ParseElementChildren(), pop(), push(), snprintf, and top().

628 {
629  //first, we need to know how many elements this tuple has:
630  const TiXmlNode* i = nullptr;
631 
632  uint32 count = 0;
633  while( ( i = field->IterateChildren( i ) ) )
634  {
635  if (i->Type() == TiXmlNode::TINYXML_ELEMENT )
636  count++;
637  }
638 
639  char iname[16];
640  snprintf( iname, sizeof( iname ), "tuple%u", mItemNumber++ );
641 
642  //now we can generate the tuple decl
643  fprintf( mOutputFile,
644  " PyTuple* %s = new PyTuple( %u );\n",
645  iname, count
646  );
647 
648  //now we need to queue up all the storage locations for the fields
649  //need to be backward
650  char varname[64];
651  while( count-- > 0 )
652  {
653  snprintf( varname, sizeof( varname ), "%s->items[ %u ]", iname, count );
654  push( varname );
655  }
656 
657  if (!ParseElementChildren( field ) )
658  return false;
659 
660  fprintf( mOutputFile,
661  " %s = %s;\n"
662  "\n",
663  top(), iname
664  );
665 
666 
667  pop();
668  return true;
669 }
const char * top() const
void push(const char *v)
FILE * mOutputFile
Definition: Generator.h:108
#define snprintf
Definition: eve-compat.h:184
unsigned __int32 uint32
Definition: eve-compat.h:50
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 ClassEncodeGenerator::ProcessWString ( const TiXmlElement *  field)
protectedvirtual

Implements Generator.

Definition at line 337 of file EncodeGenerator.cpp.

References Generator::mOutputFile, pop(), and top().

338 {
339  const char* name = field->Attribute( "name" );
340  if (name == nullptr) {
341  std::cout << std::endl << "ClassEncodeGenerator:: field at line " << field->Row() << " is missing the name attribute, skipping.";
342  return false;
343  }
344  const char* none_marker = field->Attribute( "none_marker" );
345  const char* v = top();
346  if (none_marker != nullptr )
347  fprintf( mOutputFile,
348  " if (%s == \"%s\" )\n"
349  " %s = PyStatic.NewNone();\n"
350  " else\n",
351  name, none_marker,
352  v
353  );
354 
355  fprintf( mOutputFile,
356  " %s = new PyWString( %s );\n",
357  v, name
358  );
359 
360  pop();
361  return true;
362 }
const char * top() const
FILE * mOutputFile
Definition: Generator.h:108

Here is the call graph for this function:

bool ClassEncodeGenerator::ProcessWStringInline ( const TiXmlElement *  field)
protectedvirtual

Implements Generator.

Definition at line 364 of file EncodeGenerator.cpp.

References Generator::mOutputFile, pop(), and top().

365 {
366  const char* value = field->Attribute( "value" );
367  if (value == nullptr) {
368  std::cout << std::endl << "ClassEncodeGenerator:: WString element at line " << field->Row() << " has no value attribute, skipping.";
369  return false;
370  }
371 
372  const char* v = top();
373  fprintf( mOutputFile,
374  " %s = new PyWString( \"%s\", %zu );\n",
375  v, value, strlen( value )
376  );
377 
378  pop();
379  return true;
380 }
const char * top() const
FILE * mOutputFile
Definition: Generator.h:108

Here is the call graph for this function:

void ClassEncodeGenerator::push ( const char *  v)
inlineprotected

Definition at line 40 of file EncodeGenerator.h.

References mVariableStack.

Referenced by ProcessDictInline(), ProcessElementDef(), ProcessListInline(), ProcessObjectInline(), ProcessSubStreamInline(), ProcessSubStructInline(), and ProcessTupleInline().

40 { mVariableStack.push( v ); }
std::stack< std::string > mVariableStack

Here is the caller graph for this function:

Member Data Documentation

const char* ClassEncodeGenerator::mName
private
std::stack<std::string> ClassEncodeGenerator::mVariableStack
private

Definition at line 84 of file EncodeGenerator.h.

Referenced by clear(), pop(), push(), and top().


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