ddc
Public Member Functions | Protected Attributes | List of all members
TinyXPath::node_set Class Reference

Node set class. A node set is an unordered collection of node. More...

#include <node_set.h>

Public Member Functions

 node_set ()
 constructor : creates an empty set More...
 
 node_set (const node_set &ns2)
 copy constructor More...
 
 ~ node_set ()
 destructor More...
 
node_setoperator= (const node_set &ns2)
 Assignation operator. Allows one to write expressions like ns_1 = ns_2;. More...
 
void v_add_base_in_set (const TiXmlBase *XBp_member, bool o_attrib)
 Adds a new node in the node set. More...
 
void v_add_attrib_in_set (const TiXmlAttribute *XAp_attrib)
 Adds an attribute in the node set. More...
 
void v_add_node_in_set (const TiXmlNode *XNp_node)
 Adds a node in the node set. More...
 
bool o_exist_in_set (const TiXmlBase *XBp_member)
 Checks if a node exist in the node set. More...
 
void v_add_all_foll_node (const TiXmlNode *XNp_node, const TiXmlString &S_name)
 
void v_add_all_prec_node (const TiXmlNode *XNp_node, const TiXmlString &S_name)
 
void v_add_node_in_set_if_name_or_star (const TiXmlNode *XNp_node, const TiXmlString &S_name)
 Add a new node, if the name is "*" or if the name is the same as the node. More...
 
void v_add_attrib_in_set_if_name_or_star (const TiXmlAttribute *XAp_attrib, const TiXmlString &S_name)
 Add a new attrib, if the name is "*" or if the name is the same as the node. More...
 
unsigned u_get_nb_node_in_set () const
 Get nb of nodes in the node set. More...
 
const TiXmlBaseXBp_get_base_in_set (unsigned u_which)
 Get a node or an attribute. More...
 
const TiXmlNodeXNp_get_node_in_set (unsigned u_which)
 Get a node. More...
 
const TiXmlAttributeXAp_get_attribute_in_set (unsigned u_which)
 Get an attribute. More...
 
bool o_is_attrib (unsigned u_which)
 
TiXmlString S_get_value (unsigned u_which)
 Get a node value. The value is the name for an element, and the attribute value for an attribute. More...
 
int i_get_value (unsigned u_which)
 Get the integer value of a node. More...
 
double d_get_value (unsigned u_which)
 Get the real value of a node. More...
 
void v_copy_node_children (const TiXmlNode *XNp_root)
 Copy all element children of a node to the node_set. More...
 
void v_copy_node_children (const TiXmlNode *XNp_root, const char *cp_lookup)
 Copy all element children of a node to the node_set, if their name matches a given name. More...
 
void v_copy_selected_node_recursive (const TiXmlNode *XNp_root)
 Copy all nodes in the tree to the node_set. More...
 
void v_copy_selected_node_recursive (const TiXmlNode *XNp_root, const char *cp_lookup)
 Copy all nodes in the tree to the node_set. More...
 
void v_copy_selected_node_recursive_no_attrib (const TiXmlNode *XNp_root, const char *cp_lookup)
 Copy all nodes in the tree to the node_set, excluding attributes. More...
 
TiXmlString S_get_string_value () const
 Return the string value aka concatenation of all text items. More...
 
void v_dump ()
 Debug function to print the content of a node set to stdout. More...
 
void v_document_sort ()
 

Protected Attributes

unsigned u_nb_node
 Nb of nodes in the set. More...
 
const void ** vpp_node_set
 List of node pointers to the. More...
 
bool * op_attrib
 Attributes flag list. More...
 

Detailed Description

Node set class. A node set is an unordered collection of node.

Constructor & Destructor Documentation

◆ node_set() [1/2]

TinyXPath::node_set::node_set ( )
inline

constructor : creates an empty set

References op_attrib, u_nb_node, and vpp_node_set.

◆ node_set() [2/2]

TinyXPath::node_set::node_set ( const node_set ns2)

copy constructor

Copy constructor.

◆ ~ node_set()

TinyXPath::node_set::~ node_set ( )
inline

destructor

References op_attrib, operator=(), u_nb_node, v_add_base_in_set(), and vpp_node_set.

Here is the call graph for this function:

Member Function Documentation

◆ operator=()

node_set & TinyXPath::node_set::operator= ( const node_set ns2)

Assignation operator. Allows one to write expressions like ns_1 = ns_2;.

References op_attrib, u_nb_node, and vpp_node_set.

Referenced by ~ node_set().

Here is the caller graph for this function:

◆ v_add_base_in_set()

void TinyXPath::node_set::v_add_base_in_set ( const TiXmlBase XBp_member,
bool  o_attrib 
)

Adds a new node in the node set.

Parameters
XBp_memberBase to add (node or attribute)
o_attribtrue if the base is an attribute, false if it's a node

References o_exist_in_set(), op_attrib, u_nb_node, and vpp_node_set.

Referenced by v_add_attrib_in_set(), v_add_attrib_in_set_if_name_or_star(), v_add_node_in_set(), v_add_node_in_set_if_name_or_star(), and ~ node_set().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ v_add_attrib_in_set()

void TinyXPath::node_set::v_add_attrib_in_set ( const TiXmlAttribute XAp_attrib)
inline

Adds an attribute in the node set.

References v_add_base_in_set().

Referenced by v_copy_selected_node_recursive().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ v_add_node_in_set()

void TinyXPath::node_set::v_add_node_in_set ( const TiXmlNode XNp_node)
inline

Adds a node in the node set.

References o_exist_in_set(), TIXML_STRING, v_add_all_foll_node(), v_add_all_prec_node(), and v_add_base_in_set().

Referenced by v_copy_node_children(), v_copy_selected_node_recursive(), and v_copy_selected_node_recursive_no_attrib().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ o_exist_in_set()

bool TinyXPath::node_set::o_exist_in_set ( const TiXmlBase XBp_member)

Checks if a node exist in the node set.

Parameters
XBp_memberCheck if a base exist in the node set

References u_nb_node, and vpp_node_set.

Referenced by v_add_base_in_set(), and v_add_node_in_set().

Here is the caller graph for this function:

◆ v_add_all_foll_node()

void TinyXPath::node_set::v_add_all_foll_node ( const TiXmlNode XNp_node,
const TiXmlString S_name 
)

Populate the node set with all following nodes.
Exerpt :
the following axis contains all nodes in the same document as the context node that are after the context node in document order, excluding any descendants and excluding attribute nodes and namespace nodes

Parameters
XNp_nodebase node
S_namelookup name (or "*")

References TiXmlNode::ELEMENT, v_add_node_in_set_if_name_or_star(), and v_copy_node_children().

Referenced by v_add_node_in_set().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ v_add_all_prec_node()

void TinyXPath::node_set::v_add_all_prec_node ( const TiXmlNode XNp_node,
const TiXmlString S_name 
)

Populate the node set with all preceding nodes.
Exerpt :
the preceding axis contains all nodes in the same document as the context node that are before the context node in document order, excluding any ancestors and excluding attribute nodes and namespace nodes

Parameters
XNp_nodebase node
S_namelookup name (or "*")

References TiXmlNode::ELEMENT, v_add_node_in_set_if_name_or_star(), and v_copy_node_children().

Referenced by v_add_node_in_set().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ v_add_node_in_set_if_name_or_star()

void TinyXPath::node_set::v_add_node_in_set_if_name_or_star ( const TiXmlNode XNp_node,
const TiXmlString S_name 
)
inline

Add a new node, if the name is "*" or if the name is the same as the node.

References v_add_base_in_set().

Referenced by v_add_all_foll_node(), and v_add_all_prec_node().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ v_add_attrib_in_set_if_name_or_star()

void TinyXPath::node_set::v_add_attrib_in_set_if_name_or_star ( const TiXmlAttribute XAp_attrib,
const TiXmlString S_name 
)
inline

Add a new attrib, if the name is "*" or if the name is the same as the node.

References Name, and v_add_base_in_set().

Here is the call graph for this function:

◆ u_get_nb_node_in_set()

unsigned TinyXPath::node_set::u_get_nb_node_in_set ( ) const
inline

Get nb of nodes in the node set.

References u_nb_node.

Referenced by ReadXmlField(), and TinyXPath::xpath_processor::v_execute_step().

Here is the caller graph for this function:

◆ XBp_get_base_in_set()

const TiXmlBase* TinyXPath::node_set::XBp_get_base_in_set ( unsigned  u_which)
inline

Get a node or an attribute.

References u_nb_node, and vpp_node_set.

Referenced by ReadXmlField().

Here is the caller graph for this function:

◆ XNp_get_node_in_set()

const TiXmlNode* TinyXPath::node_set::XNp_get_node_in_set ( unsigned  u_which)
inline

Get a node.

References o_is_attrib(), u_nb_node, and vpp_node_set.

Referenced by ReadXmlField(), S_get_value(), and v_dump().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ XAp_get_attribute_in_set()

const TiXmlAttribute* TinyXPath::node_set::XAp_get_attribute_in_set ( unsigned  u_which)
inline

Get an attribute.

References o_is_attrib(), u_nb_node, and vpp_node_set.

Referenced by ReadXmlField(), S_get_value(), and v_dump().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ o_is_attrib()

bool TinyXPath::node_set::o_is_attrib ( unsigned  u_which)
inline

Check if a node is an attribute or another node. This is needed because TinyXML has a weird exception for attributes not being children of TiXmlNode

References op_attrib, and u_nb_node.

Referenced by ReadXmlField(), S_get_value(), XAp_get_attribute_in_set(), and XNp_get_node_in_set().

Here is the caller graph for this function:

◆ S_get_value()

TiXmlString TinyXPath::node_set::S_get_value ( unsigned  u_which)
inline

Get a node value. The value is the name for an element, and the attribute value for an attribute.

References o_is_attrib(), TIXML_STRING, XAp_get_attribute_in_set(), and XNp_get_node_in_set().

Referenced by d_get_value(), and i_get_value().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ i_get_value()

int TinyXPath::node_set::i_get_value ( unsigned  u_which)
inline

Get the integer value of a node.

References S_get_value().

Here is the call graph for this function:

◆ d_get_value()

double TinyXPath::node_set::d_get_value ( unsigned  u_which)
inline

◆ v_copy_node_children() [1/2]

void TinyXPath::node_set::v_copy_node_children ( const TiXmlNode XNp_root)

Copy all element children of a node to the node_set.

Parameters
XNp_rootThe father of the nodes to be copied

Referenced by d_get_value(), v_add_all_foll_node(), and v_add_all_prec_node().

Here is the caller graph for this function:

◆ v_copy_node_children() [2/2]

void TinyXPath::node_set::v_copy_node_children ( const TiXmlNode XNp_root,
const char *  cp_lookup 
)

Copy all element children of a node to the node_set, if their name matches a given name.

Parameters
XNp_rootThe father of the nodes to be copied
cp_lookupLookup name (or NULL)

References v_add_node_in_set().

Here is the call graph for this function:

◆ v_copy_selected_node_recursive() [1/2]

void TinyXPath::node_set::v_copy_selected_node_recursive ( const TiXmlNode XNp_root)

Copy all nodes in the tree to the node_set.

Parameters
XNp_rootThe node to be copied

Referenced by d_get_value(), and v_copy_selected_node_recursive().

Here is the caller graph for this function:

◆ v_copy_selected_node_recursive() [2/2]

void TinyXPath::node_set::v_copy_selected_node_recursive ( const TiXmlNode XNp_root,
const char *  cp_lookup 
)

Copy all nodes in the tree to the node_set.

Parameters
XNp_rootThe node to be copied
cp_lookupLookup name (or NULL)

References TiXmlNode::ELEMENT, v_add_attrib_in_set(), v_add_node_in_set(), and v_copy_selected_node_recursive().

Here is the call graph for this function:

◆ v_copy_selected_node_recursive_no_attrib()

void TinyXPath::node_set::v_copy_selected_node_recursive_no_attrib ( const TiXmlNode XNp_root,
const char *  cp_lookup 
)

Copy all nodes in the tree to the node_set, excluding attributes.

Parameters
XNp_rootNode whole children are to be copied
cp_lookupLookup name or NULL

References v_add_node_in_set().

Referenced by d_get_value().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ S_get_string_value()

TiXmlString TinyXPath::node_set::S_get_string_value ( ) const

Return the string value aka concatenation of all text items.

References op_attrib, TiXmlNode::TEXT, TIXML_STRING, u_nb_node, and vpp_node_set.

Referenced by d_get_value().

Here is the caller graph for this function:

◆ v_dump()

void TinyXPath::node_set::v_dump ( )

Debug function to print the content of a node set to stdout.

References Name, op_attrib, u_nb_node, XAp_get_attribute_in_set(), and XNp_get_node_in_set().

Referenced by d_get_value().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ v_document_sort()

void TinyXPath::node_set::v_document_sort ( )

Sort the node set according to the document order.
The document order must have been recorded already in the tiny xml user's value
There's still a problem with the attributes. They aren't covered by the GetUserData / SetUserData yet. If two attributes come from the same element, we have to compute on the fly their relative position

References TinyXPath::i_compare_ptr_and_flag(), op_attrib, u_nb_node, and vpp_node_set.

Referenced by d_get_value().

Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ u_nb_node

unsigned TinyXPath::node_set::u_nb_node
protected

◆ vpp_node_set

const void** TinyXPath::node_set::vpp_node_set
protected

◆ op_attrib

bool* TinyXPath::node_set::op_attrib
protected

The documentation for this class was generated from the following files: