29#ifndef Pt_Decomposer_h
30#define Pt_Decomposer_h
33#include <Pt/Formatter.h>
34#include <Pt/SerializationInfo.h>
35#include <Pt/SerializationContext.h>
200 void begin(
const T& type,
const char* name)
215 *ctx << Pt::save() <<= type;
223 _si << Pt::save() <<= *_type;
224 _si.format(formatter);
230 _si << Pt::save() <<= *_type;
233 _it = _si.beginFormat(formatter);
239 if( _it == _current->end() )
241 _current->endFormat(formatter);
243 if( _current->sibling() )
245 _current = _current->sibling();
246 _it = _current->beginFormat(formatter);
250 _current = _current->parent();
252 _it = _current->end();
264 if( it != _it->
end() )
271 _it->endFormat(formatter);
void begin(const T &type, const char *name)
Begin decomposing a type.
Definition Decomposer.h:200
Decomposer * onAdvanceFormat(Formatter &formatter)
Advance formatting the type.
Definition Decomposer.h:237
void onBeginFormat(Formatter &formatter)
Begin formatting the type.
Definition Decomposer.h:228
void onFormat(Formatter &formatter)
Format the type completely.
Definition Decomposer.h:221
BasicDecomposer(SerializationContext *context=0)
Construct with context.
Definition Decomposer.h:189
virtual void onBeginFormat(Formatter &formatter)=0
Begin formatting the type.
Decomposer * advanceFormat(Formatter &formatter)
Advance formatting the type.
Definition Decomposer.h:147
void setParent(Decomposer *parent)
Sets the parent.
Definition Decomposer.h:128
Decomposer * parent() const
Returns the parent.
Definition Decomposer.h:132
virtual ~Decomposer()
Destructor.
Definition Decomposer.h:124
virtual Decomposer * onAdvanceFormat(Formatter &formatter)=0
Advance formatting the type.
virtual void onFormat(Formatter &formatter)
Format the type completely.
Definition Decomposer.h:159
Decomposer()
Default constructor.
Definition Decomposer.h:153
void format(Formatter &formatter)
Format the type completely.
Definition Decomposer.h:137
void beginFormat(Formatter &formatter)
Begin formatting the type.
Definition Decomposer.h:142
Context for the serialization of types.
Definition Api-SerializationContext.h:26
bool isReferencing() const
Returns true if references are recorded.
Definition Api-SerializationContext.h:40
Forward Iterator for child elements.
Definition SerializationInfo.h:738
Represents arbitrary types during serialization.
Definition SerializationInfo.h:59
Iterator end()
Returns an iterator to the end of child elements.
Definition SerializationInfo.h:826
Iterator beginFormat(Formatter &formatter)
Begin formatting.
Core module.
Definition Allocator.h:33