BasicComposer< T > Class Template Reference

#include <Pt/Composer.h>

Composes serializable types during serialization.

Inherits Composer.

Public Member Functions

 BasicComposer (SerializationContext *context=0)
 Construct with context.
void begin (T &type)
 Begin composing a type.
void setParent (Composer *parent)
 Sets the parent composer.
Composerparent () const
 Returns the parent composer.
void setTypeName (const std::string &type)
 Sets the type name of the type to compose.
void setTypeName (const char *type, std::size_t len)
 Sets the type name of the type to compose.
void setId (const std::string &id)
 Sets the reference id of the type to compose.
void setId (const char *id, std::size_t len)
 Sets the reference id of the type to compose.
void setString (const Pt::String &value)
 Composes a string value.
void setString (const Pt::Char *value, std::size_t len)
 Composes a string value.
void setBinary (const char *data, std::size_t length)
 Composes a binary value.
void setChar (const Pt::Char &ch)
 Composes a char value.
void setBool (bool value)
 Composes a boolean value.
void setInt (Pt::int64_t value)
 Composes a signed integer type.
void setUInt (Pt::int64_t value)
 Composes an unsigned integer type.
void setFloat (long double value)
 Composes a float value.
void setReference (const std::string &id)
 Composes a reference.
void setReference (const char *id, std::size_t len)
 Composes a reference.
ComposerbeginMember (const std::string &name)
 Begins composition of a struct member.
ComposerbeginMember (const char *name, std::size_t len)
 Begins composition of a struct member.
ComposerbeginElement ()
 Begins composition of a sequence member.
ComposerbeginDictElement ()
 Begins composition of a dict key.
ComposerbeginDictKey ()
 Begins composition of a dict key.
ComposerbeginDictValue ()
 Begins composition of a dict value.
Composerfinish ()
 Finishes composition of a struct or sequence member.

Protected Member Functions

void onSetId (const char *id, std::size_t len)
 Set reference ID.
void onSetTypeName (const char *type, std::size_t len)
 Set type name.
void onSetString (const Pt::Char *value, std::size_t len)
 Compose a string value.
void onSetBinary (const char *data, std::size_t length)
 Compose a binary value.
void onSetChar (const Pt::Char &ch)
 Compose a character value.
void onSetBool (bool value)
 Compose a bool value.
void onSetInt (Pt::int64_t value)
 Compose a integer value.
void onSetUInt (Pt::uint64_t value)
 Compose a unsigned integer value.
void onSetFloat (long double value)
 Compose a floating point value.
void onSetReference (const char *id, std::size_t len)
 Compose a reference.
ComposeronBeginMember (const char *name, std::size_t len)
 Begin composition os a struct member.
ComposeronBeginElement ()
 Begins composition of a sequence member.
ComposeronBeginDictElement ()
 Begins composition of a dict key.
ComposeronBeginDictKey ()
 Begins composition of a dict key.
ComposeronBeginDictValue ()
 Begins composition of a dict value.
ComposeronFinish ()
 Finishes composition of a struct or sequence member.

Member Function Documentation

◆ setTypeName() [1/2]

void setTypeName ( const std::string & type)
inherited

This is only supported by formats that save typename information.

◆ setTypeName() [2/2]

void setTypeName ( const char * type,
std::size_t len )
inherited

This is only supported by formats that save typename information.

◆ setId() [1/2]

void setId ( const std::string & id)
inherited

This is only supported by formats that support references.

◆ setId() [2/2]

void setId ( const char * id,
std::size_t len )
inherited

This is only supported by formats that support references.

◆ setInt()

void setInt ( Pt::int64_t value)
inherited

There is only one method for all sizes of signed integer types, because that type information is not required for composition.

◆ setUInt()

void setUInt ( Pt::int64_t value)
inherited

There is only one method for all sizes of unsigned integer types, because that type information is not required for composition.

◆ beginDictElement()

Composer * beginDictElement ( )
inherited

Returns a composer for the key of the dict element. A subsequent call of beginDictValue returns a composer to the value of the dict element. For both finish() has to be called, after the value was completely composed.