oasys::XMLMarshal Class Reference

#include <XMLSerialize.h>

Inheritance diagram for oasys::XMLMarshal:

oasys::SerializeAction oasys::Serialize

List of all members.


Detailed Description

XMLMarshal implements common functionality for building up an XML document.

Definition at line 61 of file XMLSerialize.h.


Public Member Functions

 XMLMarshal (ExpandableBuffer *buf, const char *root_tag)
virtual void end_action ()
 Control the cleanup after executing an action.
virtual void process (const char *name, SerializableObject *object)
 Process function for a contained SerializableObject.
virtual void process (const char *name, u_int64_t *i)
 Process function for an 8 byte integer.
virtual void process (const char *name, u_int32_t *i)
 Process function for a 4 byte integer.
virtual void process (const char *name, u_int16_t *i)
 Process function for a 2 byte integer.
virtual void process (const char *name, u_int8_t *i)
 Process function for a byte.
virtual void process (const char *name, bool *b)
 Process function for a boolean.
virtual void process (const char *name, u_char *bp, u_int32_t len)
 Process function for a constant length char buffer.
virtual void process (const char *name, u_char **bp, u_int32_t *lenp, int flags)
 Process function for a variable length char buffer.
virtual void process (const char *name, std::string *s)
 Process function for a c++ string.
const XMLDocumentdoc () const
 Accessor to the internal XMLDocument.

Protected Attributes

StringBuffer buf_
 completed document buffer
XMLDocument doc_
XMLObjectcurrent_node_

Constructor & Destructor Documentation

oasys::XMLMarshal::XMLMarshal ( ExpandableBuffer buf,
const char *  root_tag 
)

Definition at line 53 of file XMLSerialize.cc.

References current_node_, doc_, and oasys::XMLDocument::set_root().


Member Function Documentation

void oasys::XMLMarshal::end_action (  )  [virtual]

Control the cleanup after executing an action.

Reimplemented from oasys::SerializeAction.

Definition at line 63 of file XMLSerialize.cc.

References buf_, doc_, and oasys::XMLDocument::to_string().

void oasys::XMLMarshal::process ( const char *  name,
SerializableObject object 
) [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 69 of file XMLSerialize.cc.

References oasys::XMLObject::add_element(), and current_node_.

void oasys::XMLMarshal::process ( const char *  name,
u_int64_t *  i 
) [virtual]

Process function for an 8 byte integer.

Implements oasys::SerializeAction.

Definition at line 84 of file XMLSerialize.cc.

References oasys::XMLObject::add_attr(), oasys::StringBuffer::appendf(), current_node_, and oasys::StringBuffer::data().

void oasys::XMLMarshal::process ( const char *  name,
u_int32_t *  i 
) [virtual]

Process function for a 4 byte integer.

Implements oasys::SerializeAction.

Definition at line 92 of file XMLSerialize.cc.

References oasys::XMLObject::add_attr(), oasys::StringBuffer::appendf(), current_node_, and oasys::StringBuffer::data().

void oasys::XMLMarshal::process ( const char *  name,
u_int16_t *  i 
) [virtual]

Process function for a 2 byte integer.

Implements oasys::SerializeAction.

Definition at line 100 of file XMLSerialize.cc.

References oasys::XMLObject::add_attr(), oasys::StringBuffer::appendf(), current_node_, and oasys::StringBuffer::data().

void oasys::XMLMarshal::process ( const char *  name,
u_int8_t *  i 
) [virtual]

Process function for a byte.

Implements oasys::SerializeAction.

Definition at line 108 of file XMLSerialize.cc.

References oasys::XMLObject::add_attr(), oasys::StringBuffer::appendf(), current_node_, and oasys::StringBuffer::data().

void oasys::XMLMarshal::process ( const char *  name,
bool b 
) [virtual]

Process function for a boolean.

Implements oasys::SerializeAction.

Definition at line 116 of file XMLSerialize.cc.

References oasys::XMLObject::add_attr(), and current_node_.

void oasys::XMLMarshal::process ( const char *  name,
u_char *  bp,
u_int32_t  len 
) [virtual]

Process function for a constant length char buffer.

Parameters:
name field name
bp buffer
len buffer length

Implements oasys::SerializeAction.

Definition at line 124 of file XMLSerialize.cc.

References oasys::XMLObject::add_attr(), current_node_, encode(), and oasys::SerializeAction::signal_error().

void oasys::XMLMarshal::process ( const char *  name,
u_char **  bp,
u_int32_t *  lenp,
int  flags 
) [virtual]

Process function for a variable length char buffer.

Parameters:
name field name
bp buffer, allocated by SerializeAction if ALLOC_MEM flag is set.
lenp IN: If ALLOC_MEM flags is set, then len is the length of the buffer allocated. OUT: contains the length of the buffer
flags ALLOC_MEM as above, NULL_TERMINATED specifies that the data stored will be a null-terminated C-string.

Implements oasys::SerializeAction.

Definition at line 142 of file XMLSerialize.cc.

References oasys::XMLObject::add_attr(), ASSERT, current_node_, encode(), oasys::Serialize::NULL_TERMINATED, and oasys::SerializeAction::signal_error().

void oasys::XMLMarshal::process ( const char *  name,
std::string *  s 
) [virtual]

Process function for a c++ string.

Implements oasys::SerializeAction.

Definition at line 171 of file XMLSerialize.cc.

References oasys::XMLObject::add_attr(), and current_node_.

const XMLDocument& oasys::XMLMarshal::doc (  )  const [inline]

Accessor to the internal XMLDocument.

Definition at line 79 of file XMLSerialize.h.

References doc_.


Member Data Documentation

StringBuffer oasys::XMLMarshal::buf_ [protected]

completed document buffer

Definition at line 82 of file XMLSerialize.h.

Referenced by end_action().

XMLDocument oasys::XMLMarshal::doc_ [protected]

Definition at line 83 of file XMLSerialize.h.

Referenced by doc(), end_action(), and XMLMarshal().

XMLObject* oasys::XMLMarshal::current_node_ [protected]

Definition at line 84 of file XMLSerialize.h.

Referenced by process(), and XMLMarshal().


The documentation for this class was generated from the following files:
Generated on Sat Sep 8 08:36:25 2007 for DTN Reference Implementation by  doxygen 1.5.3