#include <StringSerialize.h>
Definition at line 29 of file StringSerialize.h.
Public Types | |
enum | { INCLUDE_NAME = 1 << 0, INCLUDE_TYPE = 1 << 1, SCHEMA_ONLY = 1 << 2, DOT_SEPARATED = 1 << 3 } |
Valid serialization options for StringSerialize. More... | |
Public Member Functions | |
StringSerialize (context_t context, int options) | |
Constructor. | |
int | action (const SerializableObject *const_object) |
We can tolerate a const object. | |
void | process (const char *name, SerializableObject *const_object) |
Process function for a contained SerializableObject. | |
const StringBuffer & | buf () |
Accessor for the serialized string. | |
void | end_action () |
void | process (const char *name, u_int64_t *i) |
void | process (const char *name, u_int32_t *i) |
void | process (const char *name, u_int16_t *i) |
void | process (const char *name, u_int8_t *i) |
void | process (const char *name, bool *b) |
void | process (const char *name, u_char *bp, u_int32_t len) |
void | process (const char *name, u_char **bp, u_int32_t *lenp, int flags) |
void | process (const char *name, std::string *s) |
Private Member Functions | |
void | add_preamble (const char *name, const char *type) |
Private Attributes | |
StringBuffer | buf_ |
string buffer | |
char | sep_ |
separator character (either " " or ".") |
anonymous enum |
Valid serialization options for StringSerialize.
INCLUDE_NAME | Serialize includes name. |
INCLUDE_TYPE | Serialize includes type. |
SCHEMA_ONLY | Don't serialize the value. |
DOT_SEPARATED | Use . not " " as field separations. |
Definition at line 32 of file StringSerialize.h.
oasys::StringSerialize::StringSerialize | ( | context_t | context, | |
int | options | |||
) |
Constructor.
Definition at line 23 of file StringSerialize.cc.
References DOT_SEPARATED, oasys::SerializeAction::options_, and sep_.
int oasys::StringSerialize::action | ( | const SerializableObject * | const_object | ) | [inline] |
We can tolerate a const object.
Definition at line 47 of file StringSerialize.h.
References oasys::SerializeAction::action().
Referenced by dtn::GlobalStore::calc_digest(), oasys::MemoryTable::del(), oasys::MemoryTable::get(), and oasys::MemoryTable::put().
void oasys::StringSerialize::process | ( | const char * | name, | |
SerializableObject * | object | |||
) | [inline, virtual] |
Process function for a contained SerializableObject.
The default implementation just calls serialize() on the contained object, ignoring the name value. However, a derived class can of course override it to make use of the name (as is done by SQLTableFormat, for example).
Reimplemented from oasys::SerializeAction.
Definition at line 53 of file StringSerialize.h.
References oasys::SerializeAction::process().
const StringBuffer& oasys::StringSerialize::buf | ( | ) | [inline] |
Accessor for the serialized string.
Definition at line 62 of file StringSerialize.h.
References buf_.
Referenced by dtn::GlobalStore::calc_digest(), oasys::MemoryTable::del(), oasys::MemoryTable::get(), and oasys::MemoryTable::put().
void oasys::StringSerialize::end_action | ( | ) | [virtual] |
Virtual functions inherited from SerializeAction
Reimplemented from oasys::SerializeAction.
Definition at line 165 of file StringSerialize.cc.
References buf_, oasys::StringBuffer::length(), and oasys::StringBuffer::trim().
void oasys::StringSerialize::process | ( | const char * | name, | |
u_int64_t * | i | |||
) | [virtual] |
Virtual functions inherited from SerializeAction
Implements oasys::SerializeAction.
Definition at line 50 of file StringSerialize.cc.
References add_preamble(), oasys::StringBuffer::append(), oasys::StringBuffer::append_int(), buf_, oasys::SerializeAction::options_, SCHEMA_ONLY, and sep_.
void oasys::StringSerialize::process | ( | const char * | name, | |
u_int32_t * | i | |||
) | [virtual] |
Virtual functions inherited from SerializeAction
Implements oasys::SerializeAction.
Definition at line 63 of file StringSerialize.cc.
References add_preamble(), oasys::StringBuffer::append(), oasys::StringBuffer::append_int(), buf_, oasys::SerializeAction::options_, SCHEMA_ONLY, and sep_.
void oasys::StringSerialize::process | ( | const char * | name, | |
u_int16_t * | i | |||
) | [virtual] |
Virtual functions inherited from SerializeAction
Implements oasys::SerializeAction.
Definition at line 76 of file StringSerialize.cc.
References add_preamble(), oasys::StringBuffer::append(), oasys::StringBuffer::append_int(), buf_, oasys::SerializeAction::options_, SCHEMA_ONLY, and sep_.
void oasys::StringSerialize::process | ( | const char * | name, | |
u_int8_t * | i | |||
) | [virtual] |
Virtual functions inherited from SerializeAction
Implements oasys::SerializeAction.
Definition at line 89 of file StringSerialize.cc.
References add_preamble(), oasys::StringBuffer::append(), oasys::StringBuffer::append_int(), buf_, oasys::SerializeAction::options_, SCHEMA_ONLY, and sep_.
void oasys::StringSerialize::process | ( | const char * | name, | |
bool * | b | |||
) | [virtual] |
Virtual functions inherited from SerializeAction
Implements oasys::SerializeAction.
Definition at line 102 of file StringSerialize.cc.
References add_preamble(), oasys::StringBuffer::append(), buf_, oasys::SerializeAction::options_, SCHEMA_ONLY, and sep_.
void oasys::StringSerialize::process | ( | const char * | name, | |
u_char * | bp, | |||
u_int32_t | len | |||
) | [virtual] |
Virtual functions inherited from SerializeAction
Implements oasys::SerializeAction.
Definition at line 120 of file StringSerialize.cc.
References add_preamble(), oasys::StringBuffer::append(), buf_, oasys::SerializeAction::options_, SCHEMA_ONLY, and sep_.
void oasys::StringSerialize::process | ( | const char * | name, | |
u_char ** | bp, | |||
u_int32_t * | lenp, | |||
int | flags | |||
) | [virtual] |
Virtual functions inherited from SerializeAction
Implements oasys::SerializeAction.
Definition at line 146 of file StringSerialize.cc.
References add_preamble(), oasys::StringBuffer::append(), buf_, oasys::Serialize::NULL_TERMINATED, oasys::SerializeAction::options_, SCHEMA_ONLY, and sep_.
void oasys::StringSerialize::process | ( | const char * | name, | |
std::string * | s | |||
) | [virtual] |
Virtual functions inherited from SerializeAction
Implements oasys::SerializeAction.
Definition at line 133 of file StringSerialize.cc.
References add_preamble(), oasys::StringBuffer::append(), buf_, oasys::SerializeAction::options_, SCHEMA_ONLY, and sep_.
void oasys::StringSerialize::add_preamble | ( | const char * | name, | |
const char * | type | |||
) | [private] |
Definition at line 35 of file StringSerialize.cc.
References oasys::StringBuffer::append(), buf_, INCLUDE_NAME, INCLUDE_TYPE, oasys::SerializeAction::options_, and sep_.
Referenced by process().
StringBuffer oasys::StringSerialize::buf_ [private] |
string buffer
Definition at line 80 of file StringSerialize.h.
Referenced by add_preamble(), buf(), end_action(), and process().
char oasys::StringSerialize::sep_ [private] |
separator character (either " " or ".")
Definition at line 81 of file StringSerialize.h.
Referenced by add_preamble(), process(), and StringSerialize().