#include <data_node_format.h>
Inheritance diagram for s11n::io::data_node_tree_builder< NodeType >:
Public Types | |
typedef NodeType | node_type |
typedef std::list< node_type * > | child_list_type |
Public Member Functions | |
data_node_tree_builder () | |
Creates a default builder. | |
virtual | ~data_node_tree_builder () |
Deletes this object's children if auto_delete() returns true. | |
bool | open_node (const std::string &classname, const std::string &nodename) |
Opens a new node, making that the current node. | |
virtual bool | close_node () |
Closes the most-recently-opened node, effectively popping the previous node off of the node stack (it is not destroyed). | |
virtual bool | add_property (const std::string &key, const std::string &val) |
Adds the given key/value pair to the current node and returns true. | |
size_t | node_count () const |
Returns the total number of nodes opened via open_node(). | |
size_t | node_depth () const |
Returns the current depth of opened nodes. | |
node_type * | root_node () const |
Returns the most recent root node parsed out of the input object. | |
node_type * | current_node () const |
Returns the current node. | |
virtual bool | change_node_class (const std::string &newclassname) |
Changes class name of current node, if one is set. |
It owns all objects which build up it's tree. If you want them you must manually remove them from the container. You normally do not want them, however - they're mostly throwaway nodes on their way to becoming fully deserialized objects.
This class only provides methods for building a tree, not for traversing it. Once you have built a tree, traverse it starting at the root_node().
Based on usage conventions this type supports only a single root node.
Definition at line 354 of file data_node_format.h.
|
Adds the given key/value pair to the current node and returns true. If no node is currently opened it returns false. Implements s11n::io::tree_builder. Definition at line 467 of file data_node_format.h. |
|
Changes class name of current node, if one is set. Returns false only if no node is currently opened, else it returns true. Implements s11n::io::tree_builder. Definition at line 524 of file data_node_format.h. |
|
Closes the most-recently-opened node, effectively popping the previous node off of the node stack (it is not destroyed). It is an error to call this more often than calling open_node(). It returns false on error (e.g., called with no opened node). Implements s11n::io::tree_builder. Definition at line 442 of file data_node_format.h. |
|
Returns the current node. Use auto_delete() to determine ownership of the returned pointer. Definition at line 514 of file data_node_format.h. |
|
Returns the current depth of opened nodes. A return value of 1 means the current node is the root node, for example, and 0 means that no node has yet been opened. Implements s11n::io::tree_builder. Definition at line 489 of file data_node_format.h. |
|
Opens a new node, making that the current node. classname will be used for the node's impl_class() (see docs for node_type::impl_class()). name will be the object's name, which is important for de/serializing the node (see node_type::name()). It returns false on error, else true. The default implementation has no error conditions, and therefor always returns true. Node that classnames and node names need not be unique (nor make up unique combinations). Any number of nodes may have the same name or classname. Implements s11n::io::tree_builder. Definition at line 400 of file data_node_format.h. |
|
Returns the most recent root node parsed out of the input object. Use auto_delete() to determine ownership of the returned pointer. Definition at line 502 of file data_node_format.h. |