#include <DataObject.h>
Collaboration diagram for DataXML::DataObject:
Public Methods | |
DataObject () | |
data object must have non-empty names, use setName(). More... | |
DataObject (std::string name) | |
name must be non-empty. More... | |
name handling | |
std::string | name () const |
void | setName (std::string name) |
shortcuts for attribute handling | |
bool | appendAttribute (std::string attr_name, std::string attr_val) |
append new attribute at end, false if name already exists. More... | |
void | setAttribute (std::string attr_name, std::string attr_val) |
modify exisiting attribute or append new at end. More... | |
void | removeAttribute (std::string attr_name) |
remove attribute. More... | |
std::string | getAttributeValue (std::string attr_name) const |
return "" if not found. More... | |
shortcuts for children handling | |
void | appendChild (const DataObject &elem) |
append child objects at end (vector::push_back()). More... | |
DataObject* | getChild (std::string child_name) |
get the first child with given name return 0 if not found. More... | |
const DataObject* | getChild (std::string child_name) const |
get the first child with given name return 0 if not found. More... | |
DataObject* | firstChild () |
return 0 if no childern. More... | |
const DataObject* | firstChild () const |
DataObject* | lastChild () |
return 0 if no children. More... | |
const DataObject* | lastChild () const |
shortcuts for text handling | |
void | appendChildText (std::string text) |
append PCDATA text as a child object. More... | |
std::string | getText () const |
get PCDATA, if 'this' is not text object return "". More... | |
direct manipulation of childern tree via STL vector | |
std::vector<DataObject>& | children () |
const std::vector<DataObject>& | children () const |
direct manipulation of attributes via STL map | |
std::map<std::string,std::string>& | attributes () |
const std::map<std::string, std::string>& | attributes () const |
Static Public Methods | |
const DataObject& | the_void_object () |
Private Attributes | |
std::string | m_name |
std::map<std::string,std::string> | m_attr |
std::vector<DataObject> | m_child |
By-value object containment is supported. Reference semantics (pointer associations) are not yet supported.
Typically you create an instance of DataObject out of your own objects. Then you use it as a high-level interface to render to/from XML.
[To implement reference semantics we need to intorduce larger units (groups of objects) for which referential integrity is guaranteed. Maybe ref integrity domain could be a root data object. Optional object identifiers must also be provided.]
dxml_copy_example.cpp, dxml_read_example.cpp, and dxml_write_example.cpp.
Definition at line 61 of file DataObject.h.
|
|
|
|
|
|
|
Referenced by main().
|
|
Referenced by main().
|
|
|
|
|
|
|
|
Referenced by main().
|
|
|
|
|
|
Referenced by main().
|
|
|
|
Referenced by main().
|
|
|
|
|
|
|
|
Referenced by main().
|
|
|
|
Referenced by main().
|
|
Referenced by main().
|
|
|
|
Definition at line 149 of file DataObject.h. |
|
Definition at line 150 of file DataObject.h. |
|
Definition at line 147 of file DataObject.h. |