#include <Pt/Formatter.h>
Support for serialization to different formats.
Inherited by Formatter, XmlFormatter, and Formatter.
Public Member Functions | |
virtual | ~Formatter () |
Destructor. | |
void | addBinary (const std::string &name, const std::string &type, const char *value, std::size_t length, const std::string &id) |
Formats a binary value. | |
void | addBinary (const char *name, const char *type, const char *value, std::size_t length, const char *id) |
Formats a binary value. | |
void | addBool (const std::string &name, bool value, const std::string &id) |
Formats a boolean value. | |
void | addBool (const char *name, bool value, const char *id) |
Formats a boolean value. | |
void | addChar (const std::string &name, const Pt::Char &value, const std::string &id) |
Formats a character value. | |
void | addChar (const char *name, const Pt::Char &value, const char *id) |
Formats a character value. | |
void | addDouble (const std::string &name, double value, const std::string &id) |
Formats a double value. | |
void | addDouble (const char *name, double value, const char *id) |
Formats a double value. | |
void | addFloat (const std::string &name, float value, const std::string &id) |
Formats a float value. | |
void | addFloat (const char *name, float value, const char *id) |
Formats a float value. | |
void | addInt16 (const std::string &name, Pt::int16_t value, const std::string &id) |
Formats a 16-bit signed integer value. | |
void | addInt16 (const char *name, Pt::int16_t value, const char *id) |
Formats a 16-bit signed integer value. | |
void | addInt32 (const std::string &name, Pt::int32_t value, const std::string &id) |
Formats a 32-bit signed integer value. | |
void | addInt32 (const char *name, Pt::int32_t value, const char *id) |
Formats a 32-bit signed integer value. | |
void | addInt64 (const std::string &name, Pt::int64_t value, const std::string &id) |
Formats a 64-bit signed integer value. | |
void | addInt64 (const char *name, Pt::int64_t value, const char *id) |
Formats a 64-bit signed integer value. | |
void | addInt8 (const std::string &name, Pt::int8_t value, const std::string &id) |
Formats a 8-bit signed integer value. | |
void | addInt8 (const char *name, Pt::int8_t value, const char *id) |
Formats a 8-bit signed integer value. | |
void | addLongDouble (const std::string &name, long double value, const std::string &id) |
Formats a long double value. | |
void | addLongDouble (const char *name, long double value, const char *id) |
Formats a long double value. | |
void | addReference (const std::string &name, const std::string &refId) |
Formats a reference. | |
void | addReference (const char *name, const char *refId) |
Formats a reference. | |
void | addString (const std::string &name, const std::string &type, const Pt::String &value, const std::string &id) |
Formats a string value. | |
void | addString (const char *name, const char *type, const Pt::Char *value, const char *id) |
Formats a string value. | |
void | addUInt16 (const std::string &name, Pt::uint16_t value, const std::string &id) |
Formats a 16-bit unsigned integer value. | |
void | addUInt16 (const char *name, Pt::uint16_t value, const char *id) |
Formats a 16-bit unsigned integer value. | |
void | addUInt32 (const std::string &name, Pt::uint32_t value, const std::string &id) |
Formats a 32-bit unsigned integer value. | |
void | addUInt32 (const char *name, Pt::uint32_t value, const char *id) |
Formats a 32-bit unsigned integer value. | |
void | addUInt64 (const std::string &name, Pt::uint64_t value, const std::string &id) |
Formats a 64-bit unsigned integer value. | |
void | addUInt64 (const char *name, Pt::uint64_t value, const char *id) |
Formats a 64-bit unsigned integer value. | |
void | addUInt8 (const std::string &name, Pt::uint8_t value, const std::string &id) |
Formats a 8-bit unsigned integer value. | |
void | addUInt8 (const char *name, Pt::uint8_t value, const char *id) |
Formats a 8-bit unsigned integer value. | |
void | beginDict (const std::string &name, const std::string &type, const std::string &id) |
Formats the begin of a dict. | |
void | beginDict (const char *name, const char *type, const char *id) |
Formats the begin of a dict. | |
void | beginDictElement () |
Formats the begin of a dict element. | |
void | beginDictKey () |
Formats the begin of a dict key. | |
void | beginDictValue () |
Formats the begin of a dict value. | |
void | beginElement () |
Formats the begin of an array element. | |
void | beginMember (const std::string &name) |
Formats the begin of a struct member. | |
void | beginMember (const char *name) |
Formats the begin of a struct member. | |
void | beginParse (Composer &composer) |
Begin to parse to a composer. | |
void | beginSequence (const std::string &name, const std::string &type, const std::string &id) |
Formats the begin of an array. | |
void | beginSequence (const char *name, const char *type, const char *id) |
Formats the begin of an array. | |
void | beginStruct (const std::string &name, const std::string &type, const std::string &id) |
Formats the begin of a struct. | |
void | beginStruct (const char *name, const char *type, const char *id) |
Formats the begin of a struct. | |
void | finishDict () |
Formats the end of a dict. | |
void | finishDictElement () |
Formats the end of a dict element. | |
void | finishDictKey () |
Formats the end of a dict key. | |
void | finishDictValue () |
Formats the end of a dict value. | |
void | finishElement () |
Formats the end of an array element. | |
void | finishMember () |
Formats the end of a struct member. | |
void | finishSequence () |
Formats the end of an array. | |
void | finishStruct () |
Formats the end of a struct. | |
void | parse () |
Parse until composer completes. | |
bool | parseSome () |
Returns true if composer completes, false if no more data available. | |
Protected Member Functions | |
Formatter () | |
Default constructor. | |
virtual void | onAddBinary (const char *name, const char *type, const char *value, std::size_t length, const char *id)=0 |
Formats a binary value. | |
virtual void | onAddBool (const char *name, bool value, const char *id)=0 |
Formats a bool value. | |
virtual void | onAddChar (const char *name, const Pt::Char &value, const char *id)=0 |
Formats a character value. | |
virtual void | onAddDouble (const char *name, double value, const char *id)=0 |
Formats a double value. | |
virtual void | onAddFloat (const char *name, float value, const char *id)=0 |
Formats a float value. | |
virtual void | onAddInt16 (const char *name, Pt::int16_t value, const char *id)=0 |
Formats a 16-bit integer. | |
virtual void | onAddInt32 (const char *name, Pt::int32_t value, const char *id)=0 |
Formats a 32-bit integer. | |
virtual void | onAddInt64 (const char *name, Pt::int64_t value, const char *id)=0 |
Formats a 64-bit integer. | |
virtual void | onAddInt8 (const char *name, Pt::int8_t value, const char *id)=0 |
Formats a 8-bit integer. | |
virtual void | onAddLongDouble (const char *name, long double value, const char *id)=0 |
Formats a long double value. | |
virtual void | onAddReference (const char *name, const char *refId)=0 |
Formats a reference. | |
virtual void | onAddString (const char *name, const char *type, const Pt::Char *value, const char *id)=0 |
Formats a string value. | |
virtual void | onAddUInt16 (const char *name, Pt::uint16_t value, const char *id)=0 |
Formats a 16-bit unsigned integer. | |
virtual void | onAddUInt32 (const char *name, Pt::uint32_t value, const char *id)=0 |
Formats a 32-bit unsigned integer. | |
virtual void | onAddUInt64 (const char *name, Pt::uint64_t value, const char *id)=0 |
Formats a 64-bit unsigned integer. | |
virtual void | onAddUInt8 (const char *name, Pt::uint8_t value, const char *id)=0 |
Formats a 8-bit unsigned integer. | |
virtual void | onBeginDict (const char *name, const char *type, const char *id) |
Formats the begin of a dict. | |
virtual void | onBeginDictElement () |
Formats the begin of a dict element. | |
virtual void | onBeginDictKey () |
Formats the begin of a dict key. | |
virtual void | onBeginDictValue () |
Formats the begin of a dict value. | |
virtual void | onBeginElement ()=0 |
Formats the begin of a sequence element. | |
virtual void | onBeginMember (const char *name)=0 |
Formats the begin of a struct member. | |
virtual void | onBeginParse (Composer &composer)=0 |
Begin to parse to a composer. | |
virtual void | onBeginSequence (const char *name, const char *type, const char *id)=0 |
Formats the begin of a sequence. | |
virtual void | onBeginStruct (const char *name, const char *type, const char *id)=0 |
Formats the begin of a struct. | |
virtual void | onFinishDict () |
Formats the end of a dict. | |
virtual void | onFinishDictElement () |
Formats the end of a dict element. | |
virtual void | onFinishDictKey () |
Formats the end of a dict key. | |
virtual void | onFinishDictValue () |
Formats the end of a dict value. | |
virtual void | onFinishElement ()=0 |
Formats the end of a sequence element. | |
virtual void | onFinishMember ()=0 |
Formats the end of a struct member. | |
virtual void | onFinishSequence ()=0 |
Formats the end of a sequence. | |
virtual void | onFinishStruct ()=0 |
Formats the end of a struct. | |
virtual void | onParse ()=0 |
Parse until composer completes. | |
virtual bool | onParseSome ()=0 |
Returns true if composer completes, false if no more data available. | |