sprint 1-alpha
Public Types | Public Member Functions | Public Attributes
sprint::xml::node Struct Reference

#include <uxml.h>

Inherited by sprint::xml::document.

List of all members.

Public Types

typedef node_list_t::const_iterator const_iterator
typedef node_list_t::iterator iterator

Public Member Functions

 node ()
 empty costructor
 node (const char *p_id)
 costructor with a classname
const_iterator cbegin () const
 Iterator on childs.
const_iterator cend () const
 Iterator on childs.
void add (const node &n)
bool find_attr (const std::string &key, std::string &value) const
 Find a key in the attr vector.
template<class T >
void set_attr (const std::string &key, T value)
template<class T >
get_attr (const std::string &key, T _default) const
bool has_child () const
 Has at least one child?
const nodefirst_child () const
nodefirst_child ()
 Return the first CHild (have to check before if have child)
nodefind_child_by_class (const char *classid)
const nodefind_child_by_class (const char *classid) const
nodeset_text (const char *txt)
nodeset_text (const std::string &txt)

Public Attributes

std::string id
 XML Node ID.
std::string text
 XML Node Text.
attr_list_t attr
 Attribute lists.
node_list_t child
 Child.

Detailed Description

An XML node


Member Function Documentation

void sprint::xml::node::add ( const node n)

append a new child

node* sprint::xml::node::find_child_by_class ( const char *  classid)

find a child by his class ID

Returns:
the node if exists, or NULL
  sprint::xml::node * palette = dom.find_child_by_class("palette");
  if(palette) { .. do something ... }
const node& sprint::xml::node::first_child ( ) const

Return the first CHild (have to check before if have child)

  const sprint::xml::node & tile = xml.first_child();
template<class T >
T sprint::xml::node::get_attr ( const std::string &  key,
_default 
) const

cast and return a value default

  angle_0 = palette.get_attr("start", angle_0);
  mul_factor = palette.get_attr("multiply", mul_factor);
  color_mode = palette.get_attr("set", color_mode);                                                  
template<class T >
void sprint::xml::node::set_attr ( const std::string &  key,
value 
)

Set the xml attributes for the current node

  palette.set_attr("start", angle_0);
  palette.set_attr("multiply", anglmul_factore_0);
  palette.set_attr("set", color_mode);                                                  
node& sprint::xml::node::set_text ( const char *  txt)

set text

  root.add(sprint::xml::node("name").set_text("mandelbrot"));

The documentation for this struct was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines