![]() |
SimulationCraft
SimulationCraft is a tool to explore combat mechanics in the popular MMO RPG World of Warcraft (tm).
|
This class represents root of the DOM hierarchy. More...
#include <rapidxml.hpp>
Public Member Functions | |
xml_document () | |
Constructs empty XML document. | |
template<int Flags> | |
void | parse (Ch *text) |
Parses zero-terminated XML string according to given flags. More... | |
void | clear () |
Clears the document by deleting all nodes and clearing the memory pool. More... | |
![]() | |
xml_node (node_type type) | |
Constructs an empty node with the specified type. More... | |
node_type | type () const |
Gets type of node. More... | |
xml_document< Ch > * | document () const |
Gets document of which node is a child. More... | |
xml_node< Ch > * | first_node (const Ch *name=0, std::size_t name_size=0, bool case_sensitive=true) const |
Gets first child node, optionally matching node name. More... | |
xml_node< Ch > * | last_node (const Ch *name=0, std::size_t name_size=0, bool case_sensitive=true) const |
Gets last child node, optionally matching node name. More... | |
xml_node< Ch > * | previous_sibling (const Ch *name=0, std::size_t name_size=0, bool case_sensitive=true) const |
Gets previous sibling node, optionally matching node name. More... | |
xml_node< Ch > * | next_sibling (const Ch *name=0, std::size_t name_size=0, bool case_sensitive=true) const |
Gets next sibling node, optionally matching node name. More... | |
xml_attribute< Ch > * | first_attribute (const Ch *name=0, std::size_t name_size=0, bool case_sensitive=true) const |
Gets first attribute of node, optionally matching attribute name. More... | |
xml_attribute< Ch > * | last_attribute (const Ch *name=0, std::size_t name_size=0, bool case_sensitive=true) const |
Gets last attribute of node, optionally matching attribute name. More... | |
void | type (node_type type) |
Sets type of node. More... | |
void | prepend_node (xml_node< Ch > *child) |
Prepends a new child node. More... | |
void | append_node (xml_node< Ch > *child) |
Appends a new child node. More... | |
void | insert_node (xml_node< Ch > *where, xml_node< Ch > *child) |
Inserts a new child node at specified place inside the node. More... | |
void | remove_first_node () |
Removes first child node. More... | |
void | remove_last_node () |
Removes last child of the node. More... | |
void | remove_node (xml_node< Ch > *where) |
Removes specified child from the node. | |
void | remove_all_nodes () |
Removes all child nodes (but not attributes). | |
void | prepend_attribute (xml_attribute< Ch > *attribute) |
Prepends a new attribute to the node. More... | |
void | append_attribute (xml_attribute< Ch > *attribute) |
Appends a new attribute to the node. More... | |
void | insert_attribute (xml_attribute< Ch > *where, xml_attribute< Ch > *attribute) |
Inserts a new attribute at specified place inside the node. More... | |
void | remove_first_attribute () |
Removes first attribute of the node. More... | |
void | remove_last_attribute () |
Removes last attribute of the node. More... | |
void | remove_attribute (xml_attribute< Ch > *where) |
Removes specified attribute from node. More... | |
void | remove_all_attributes () |
Removes all attributes of node. | |
![]() | |
Ch * | name () const |
Gets name of the node. More... | |
std::size_t | name_size () const |
Gets size of node name, not including terminator character. More... | |
Ch * | value () const |
Gets value of node. More... | |
std::size_t | value_size () const |
Gets size of node value, not including terminator character. More... | |
void | name (const Ch *name, std::size_t size) |
Sets name of node to a non zero-terminated string. More... | |
void | name (const Ch *name) |
Sets name of node to a zero-terminated string. More... | |
void | value (const Ch *value, std::size_t size) |
Sets value of node to a non zero-terminated string. More... | |
void | value (const Ch *value) |
Sets value of node to a zero-terminated string. More... | |
xml_node< Ch > * | parent () const |
Gets node parent. More... | |
![]() | |
memory_pool () | |
Constructs empty pool with default allocator functions. | |
~memory_pool () | |
Destroys pool and frees all the memory. More... | |
xml_node< Ch > * | allocate_node (node_type type, const Ch *name=0, const Ch *value=0, std::size_t name_size=0, std::size_t value_size=0) |
Allocates a new node from the pool, and optionally assigns name and value to it. More... | |
xml_attribute< Ch > * | allocate_attribute (const Ch *name=0, const Ch *value=0, std::size_t name_size=0, std::size_t value_size=0) |
Allocates a new attribute from the pool, and optionally assigns name and value to it. More... | |
Ch * | allocate_string (const Ch *source=0, std::size_t size=0) |
Allocates a char array of given size from the pool, and optionally copies a given string to it. More... | |
xml_node< Ch > * | clone_node (const xml_node< Ch > *source, xml_node< Ch > *result=0) |
Clones an xml_node and its hierarchy of child nodes and attributes. More... | |
void | clear () |
Clears the pool. More... | |
void | set_allocator (alloc_func *af, free_func *ff) |
Sets or resets the user-defined memory allocation functions for the pool. More... | |
Additional Inherited Members | |
![]() | |
static Ch * | nullstr () |
![]() | |
Ch * | m_name |
Ch * | m_value |
std::size_t | m_name_size |
std::size_t | m_value_size |
xml_node< Ch > * | m_parent |
This class represents root of the DOM hierarchy.
It is also an xml_node and a memory_pool through public inheritance. Use parse() function to build a DOM tree from a zero-terminated XML text string. parse() function allocates memory for nodes and attributes by using functions of xml_document, which are inherited from memory_pool. To access root node of the document, use the document itself, as if it was an xml_node.
Ch | Character type to use. |
|
inline |
Clears the document by deleting all nodes and clearing the memory pool.
All nodes owned by document pool are destroyed.
|
inline |
Parses zero-terminated XML string according to given flags.
Passed string will be modified by the parser, unless rapidxml::parse_non_destructive flag is used. The string must persist for the lifetime of the document. In case of error, rapidxml::parse_error exception will be thrown.
If you want to parse contents of a file, you must first load the file into the memory, and pass pointer to its beginning. Make sure that data is zero-terminated.
Document can be parsed into multiple times. Each new call to parse removes previous nodes and attributes (if any), but does not clear memory pool.
text | XML data to parse; pointer is non-const to denote fact that this data may be modified by the parser. |