bxml_element Class Reference

#include <bxml_document.h>

Inheritance diagram for bxml_element:

bxml_data vbl_ref_count List of all members.

Detailed Description

An XML element.

Definition at line 72 of file bxml_document.h.


Public Types

typedef vcl_vector< bxml_data_sptr
>::const_iterator 
const_data_iterator
typedef vcl_map< vcl_string,
vcl_string >::const_iterator 
const_attr_iterator
enum  datatype { TEXT, ELEMENT }

Public Member Functions

 bxml_element ()
 Constructor - default.
 bxml_element (const vcl_string &name)
 Constructor.
virtual ~bxml_element ()
 Destructor.
datatype type () const
 Return the type of XML data.
vcl_string name () const
 Return the name of the element.
vcl_string attribute (const vcl_string &attr_name) const
 Return the value of an attribute.
template<class T>
bool get_attribute (const vcl_string &attr_name, T &value) const
 Return the value of an attribute.
unsigned int num_attributes () const
 Return the number of attributes.
const_attr_iterator attr_begin () const
 An iterator to the beginning of the attributes.
const_attr_iterator attr_end () const
 An iterator to the end of the attributes.
unsigned int num_data () const
 Return the number of data nodes.
const_data_iterator data_begin () const
 An iterator to the beginning of the data.
const_data_iterator data_end () const
 An iterator to the end of the data.
void append_text (const vcl_string &text)
 Append text in this element.
void append_data (const bxml_data_sptr &el)
 Append data (typically another element) in this element.
void set_attribute (const vcl_string &attr_name, const vcl_string &attr_value)
template<class T>
void set_attribute (const vcl_string &attr_name, const T &attr_value)
void ref ()
void unref ()
int get_references () const
bool is_referenced () const

Private Attributes

vcl_string name_
 The name of the element.
vcl_map< vcl_string, vcl_string > attributes_
 The map of attributes to values.
vcl_vector< bxml_data_sptrdata_
 The character data.

Member Typedef Documentation

typedef vcl_vector<bxml_data_sptr>::const_iterator bxml_element::const_data_iterator

Definition at line 75 of file bxml_document.h.

typedef vcl_map<vcl_string,vcl_string>::const_iterator bxml_element::const_attr_iterator

Definition at line 76 of file bxml_document.h.


Member Enumeration Documentation

enum bxml_data::datatype [inherited]

Enumerator:
TEXT 
ELEMENT 

Definition at line 32 of file bxml_document.h.


Constructor & Destructor Documentation

bxml_element::bxml_element (  )  [inline]

Constructor - default.

Definition at line 79 of file bxml_document.h.

bxml_element::bxml_element ( const vcl_string &  name  )  [inline]

Constructor.

Definition at line 82 of file bxml_document.h.

virtual bxml_element::~bxml_element (  )  [inline, virtual]

Destructor.

Definition at line 85 of file bxml_document.h.


Member Function Documentation

datatype bxml_element::type (  )  const [inline, virtual]

Return the type of XML data.

Implements bxml_data.

Definition at line 88 of file bxml_document.h.

vcl_string bxml_element::name (  )  const [inline]

Return the name of the element.

Definition at line 91 of file bxml_document.h.

vcl_string bxml_element::attribute ( const vcl_string &  attr_name  )  const

Return the value of an attribute.

Definition at line 15 of file bxml_document.cxx.

template<class T>
bool bxml_element::get_attribute ( const vcl_string &  attr_name,
T &  value 
) const [inline]

Return the value of an attribute.

Definition at line 98 of file bxml_document.h.

unsigned int bxml_element::num_attributes (  )  const [inline]

Return the number of attributes.

Definition at line 108 of file bxml_document.h.

const_attr_iterator bxml_element::attr_begin (  )  const [inline]

An iterator to the beginning of the attributes.

Definition at line 111 of file bxml_document.h.

const_attr_iterator bxml_element::attr_end (  )  const [inline]

An iterator to the end of the attributes.

Definition at line 114 of file bxml_document.h.

unsigned int bxml_element::num_data (  )  const [inline]

Return the number of data nodes.

Definition at line 117 of file bxml_document.h.

const_data_iterator bxml_element::data_begin (  )  const [inline]

An iterator to the beginning of the data.

Definition at line 120 of file bxml_document.h.

const_data_iterator bxml_element::data_end (  )  const [inline]

An iterator to the end of the data.

Definition at line 123 of file bxml_document.h.

void bxml_element::append_text ( const vcl_string &  text  ) 

Append text in this element.

Definition at line 35 of file bxml_document.cxx.

void bxml_element::append_data ( const bxml_data_sptr el  )  [inline]

Append data (typically another element) in this element.

Definition at line 129 of file bxml_document.h.

void bxml_element::set_attribute ( const vcl_string &  attr_name,
const vcl_string &  attr_value 
) [inline]

Definition at line 132 of file bxml_document.h.

template<class T>
void bxml_element::set_attribute ( const vcl_string &  attr_name,
const T &  attr_value 
) [inline]

Definition at line 136 of file bxml_document.h.


Member Data Documentation

vcl_string bxml_element::name_ [private]

The name of the element.

Definition at line 145 of file bxml_document.h.

vcl_map<vcl_string,vcl_string> bxml_element::attributes_ [private]

The map of attributes to values.

Definition at line 148 of file bxml_document.h.

vcl_vector<bxml_data_sptr> bxml_element::data_ [private]

The character data.

Definition at line 151 of file bxml_document.h.


The documentation for this class was generated from the following files:
Generated on Wed Oct 15 05:20:24 2008 for contrib/brl/bbas/bxml by  doxygen 1.5.1