40 fprintf(
mInto,
"%s<int name=\"integer%u\" />\n",
_pfx(),
mItem++ );
75 fprintf(
mInto,
"%s<buffer name=\"buffer%u\" />\n",
_pfx(),
mItem++ );
82 fprintf(
mInto,
"%s<string name=\"string%u\" />\n",
_pfx(),
mItem++ );
89 fprintf(
mInto,
"%s<!-- PyPackedRow stub -->\n",
_pfx() );
96 fprintf(
mInto,
"%s<objectInline>\n",
_pfx() );
102 fprintf(
mInto,
"%s</objectInline>\n",
_pfx() );
109 fprintf(
mInto,
"%s<!-- PyObjectEx stub -->\n",
_pfx() );
116 fprintf(
mInto,
"%s<substructInline>\n",
_pfx() );
122 fprintf(
mInto,
"%s</substructInline>\n",
_pfx() );
129 fprintf(
mInto,
"%s<substreamInline>\n",
_pfx() );
135 fprintf(
mInto,
"%s</substreamInline>\n",
_pfx() );
142 fprintf(
mInto,
"%s<!-- PyChecksumedStream stub -->\n",
_pfx() );
167 vtype = ValueUnknown;
173 for(; cur != end; ++cur)
175 if( cur->first->IsString() )
177 if( ktype == DictIntKey )
183 else if( ktype == DictInline )
184 ktype = DictStringKey;
186 else if( cur->first->IsInt() )
188 if( ktype == DictStringKey )
194 else if( ktype == DictInline )
204 if( cur->second->IsString() )
206 if( vtype == ValueInt || vtype == ValueReal )
208 else if( vtype == ValueUnknown )
211 else if(cur->second->IsInt())
213 if( vtype == ValueString || vtype == ValueReal )
215 else if( vtype == ValueUnknown )
218 else if( cur->second->IsFloat() )
220 if( vtype == ValueString || vtype == ValueInt )
222 else if(vtype == ValueUnknown)
229 if( ktype == DictRaw )
231 fprintf(
mInto,
"%s<dict name=\"dict%u\" />\n",
_pfx(),
mItem++ );
234 else if( ktype == DictIntKey )
240 fprintf(
mInto,
"%s<dictInt name=\"dict%u\" type=\"string\" />\n",
_pfx(),
mItem++ );
243 fprintf(
mInto,
"%s<dictInt name=\"dict%u\" type=\"int\" />\n",
_pfx(),
mItem++ );
246 fprintf(
mInto,
"%s<dictInt name=\"dict%u\" type=\"real\" />\n",
_pfx(),
mItem++ );
250 fprintf(
mInto,
"%s<dictRaw name=\"dict%u\" />\n",
_pfx(),
mItem++ );
257 fprintf(
mInto,
"%s<dictInline>\n",
_pfx() );
264 for(; cur != end; ++cur)
266 if( !cur->first->IsString() )
268 fprintf(
mInto,
"%s<!-- non-string dict key of type %s -->\n",
_pfx(), cur->first->TypeString() );
273 fprintf(
mInto,
"%s<dictInlineEntry key=\"%s\">\n",
_pfx(), str->
content().c_str() );
276 cur->second->visit( *
this );
279 fprintf(
mInto,
"%s</dictInlineEntry>\n",
_pfx() );
284 fprintf(
mInto,
"%s</dictInline>\n",
_pfx() );
293 if( rep->
size() < 5 )
295 fprintf(
mInto,
"%s<listInline>\n",
_pfx() );
303 for(
uint32 i = 0; cur != end; ++cur, ++i )
305 fprintf(
mInto,
"%s<!-- %u -->\n",
_pfx(), i );
306 (*cur)->visit( *
this );
311 fprintf(
mInto,
"%s</listInline>\n",
_pfx() );
323 eletype = TypeUnknown;
329 for(; cur != end; cur++)
331 if( (*cur)->IsString() )
333 if( eletype == TypeInteger || eletype == TypeReal )
338 else if( eletype == TypeUnknown )
339 eletype = TypeString;
341 else if( (*cur)->IsInt() )
343 if( eletype == TypeString || eletype == TypeReal )
348 else if( eletype == TypeUnknown )
349 eletype = TypeInteger;
351 else if( (*cur)->IsFloat() )
353 if( eletype == TypeString || eletype == TypeInteger )
358 else if( eletype == TypeUnknown )
371 fprintf(
mInto,
"%s<listStr name=\"list%u\" />\n",
_pfx(),
mItem++ );
374 fprintf(
mInto,
"%s<listInt name=\"list%u\" />\n",
_pfx(),
mItem++ );
377 fprintf(
mInto,
"%s<listReal name=\"list%u\" />\n",
_pfx(),
mItem++ );
381 fprintf(
mInto,
"%s<list name=\"list%u\" />\n",
_pfx(),
mItem++ );
391 fprintf(
mInto,
"%s<tupleInline>\n",
_pfx() );
399 for(
uint32 i = 0; cur != end; ++cur, ++i)
401 fprintf(
mInto,
"%s<!-- %d -->\n",
_pfx(), i );
402 (*cur)->visit( *
this );
407 fprintf(
mInto,
"%s</tupleInline>\n",
_pfx() );
bool VisitChecksumedStream(const PyChecksumedStream *rep)
bool VisitInteger(const PyInt *rep)
primitive data visitors
void _pfxExtend(const char *fmt,...)
virtual bool VisitSubStream(const PySubStream *rep)
bool VisitObject(const PyObject *rep)
Object type visitor.
bool VisitDict(const PyDict *rep)
bool VisitBoolean(const PyBool *rep)
bool VisitList(const PyList *rep)
bool VisitSubStruct(const PySubStruct *rep)
wrapper types Visitor
bool VisitNone(const PyNone *rep)
storage_type::const_iterator const_iterator
Python floating point number.
bool VisitReal(const PyFloat *rep)
const_iterator begin() const
storage_type::const_iterator const_iterator
bool VisitBuffer(const PyBuffer *rep)
bool VisitString(const PyString *rep)
virtual bool VisitSubStruct(const PySubStruct *rep)
wrapper types Visitor
bool VisitPackedRow(const PyPackedRow *rep)
PackedRow type visitor.
const_iterator begin() const
virtual bool VisitObject(const PyObject *rep)
Object type visitor.
const_iterator end() const
storage_type::const_iterator const_iterator
bool VisitObjectEx(const PyObjectEx *rep)
bool VisitSubStream(const PySubStream *rep)
const std::string & content() const
Get the PyString content.
const_iterator end() const
bool VisitLong(const PyLong *rep)
const_iterator end() const
const_iterator begin() const
PyXMLGenerator(FILE *into, const char *pfx="")
const char * _pfx() const
bool VisitTuple(const PyTuple *rep)
the nested types Visitor