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>
106 template <
typename T>
123 void begin(
const T& type,
const char* name)
138 *ctx << Pt::save() <<= type;
146 _si << Pt::save() <<= *_type;
153 _si << Pt::save() <<= *_type;
162 if( _it == _current->
end() )
166 if( _current->sibling() )
168 _current = _current->sibling();
173 _current = _current->
parent();
175 _it = _current->
end();
187 if( it != _it->
end() )
Manages the decomposition of types during serialization.
Definition: Decomposer.h:107
void format(Formatter &formatter)
Format the type completely.
Definition: Decomposer.h:60
virtual void onBeginFormat(Formatter &formatter)=0
Begin formatting the type.
virtual Decomposer * onAdvanceFormat(Formatter &formatter)=0
Advance formatting the type.
SerializationInfo * parent()
Returns the parent node.
Definition: SerializationInfo.h:206
Iterator end()
Returns an iterator to the end of child elements.
Definition: SerializationInfo.h:822
void setName(const std::string &name)
Sets the instance name.
void endFormat(Formatter &formatter)
End formatting.
Decomposer * parent() const
Returns the parent.
Definition: Decomposer.h:55
BasicDecomposer(SerializationContext *context=0)
Construct with context.
Definition: Decomposer.h:112
void onFormat(Formatter &formatter)
Format the type completely.
Definition: Decomposer.h:144
bool isReferencing() const
Returns true if references are recorded.
Definition: SerializationContext.h:35
Iterator beginFormat(Formatter &formatter)
Begin formatting.
void setParent(Decomposer *parent)
Sets the parent.
Definition: Decomposer.h:51
void onBeginFormat(Formatter &formatter)
Begin formatting the type.
Definition: Decomposer.h:151
Decomposer()
Default constructor.
Definition: Decomposer.h:76
void clear()
Clears all content.
Decomposer * advanceFormat(Formatter &formatter)
Advance formatting the type.
Definition: Decomposer.h:70
void begin(const T &type, const char *name)
Begin decomposing a type.
Definition: Decomposer.h:123
Context for the serialization of types.
Definition: SerializationContext.h:20
void beginFormat(Formatter &formatter)
Begin formatting the type.
Definition: Decomposer.h:65
Represents arbitrary types during serialization.
Definition: SerializationInfo.h:58
Manages the decomposition of types during serialization.
Definition: Decomposer.h:43
void format(Formatter &formatter) const
Format complete value or all members.
Decomposer * onAdvanceFormat(Formatter &formatter)
Advance formatting the type.
Definition: Decomposer.h:160
Forward Iterator for child elements.
Definition: SerializationInfo.h:733
virtual void onFormat(Formatter &formatter)
Format the type completely.
Definition: Decomposer.h:82
SerializationContext * context() const
Returns the used context.
Definition: SerializationInfo.h:185
virtual ~Decomposer()
Destructor.
Definition: Decomposer.h:47