frepple::utils::XMLElement Class Reference

This class represents an XML element being read in from the input file. More...

#include <utils.h>

Inheritance diagram for frepple::utils::XMLElement:

Public Member Functions

void addData (const char *pData, size_t len)
 
bool getBool () const
 
const char * getData () const
 
virtual Date getDate () const
 
virtual double getDouble () const
 
virtual int getInt () const
 
virtual long getLong () const
 
virtual string getString () const
 
virtual TimePeriod getTimeperiod () const
 
virtual unsigned long getUnsignedLong () const
 
virtual operator bool () const
 
void reset ()
 
void setData (const char *pData)
 
 XMLElement ()
 
 XMLElement (const string &v)
 
virtual ~XMLElement ()
 
- Public Member Functions inherited from frepple::utils::DataElement
void operator>> (unsigned long int &val) const
 
void operator>> (long &val) const
 
void operator>> (TimePeriod &val) const
 
void operator>> (bool &v) const
 
void operator>> (int &val) const
 
void operator>> (double &val) const
 
void operator>> (Date &val) const
 
void operator>> (string &val) const
 
virtual ~DataElement ()
 

Detailed Description

This class represents an XML element being read in from the input file.

Definition at line 2583 of file utils.h.

Constructor & Destructor Documentation

frepple::utils::XMLElement::XMLElement ( )
inline

Default constructor.

Definition at line 2593 of file utils.h.

frepple::utils::XMLElement::XMLElement ( const string &  v)
inline

Constructor.

Definition at line 2596 of file utils.h.

virtual frepple::utils::XMLElement::~XMLElement ( )
inlinevirtual

Destructor.

Definition at line 2599 of file utils.h.

Member Function Documentation

void frepple::utils::XMLElement::addData ( const char *  pData,
size_t  len 
)
inline

Add some characters to this data field of this element.
The second argument is the number of bytes, not the number of characters.

Definition at line 2611 of file utils.h.

bool frepple::utils::XMLElement::getBool ( ) const
virtual

Interprets the element as a boolean value.

Our implementation is a bit more generous and forgiving than the boolean datatype that is part of the XML schema v2 standard. The standard expects the following literals:
{true, false, 1, 0}

Our implementation uses only the first charater of the text, and is case insensitive. It thus matches a wider range of values:
{t.*, T.*, f.*, F.*, 1.*, 0.*}

Reimplemented from frepple::utils::DataElement.

Definition at line 695 of file xmlparser.cpp.

const char* frepple::utils::XMLElement::getData ( ) const
inline

Return the data field.

Definition at line 2617 of file utils.h.

virtual Date frepple::utils::XMLElement::getDate ( ) const
inlinevirtual

Reimplemented from frepple::utils::DataElement.

Definition at line 2629 of file utils.h.

virtual double frepple::utils::XMLElement::getDouble ( ) const
inlinevirtual

Reimplemented from frepple::utils::DataElement.

Definition at line 2627 of file utils.h.

virtual int frepple::utils::XMLElement::getInt ( ) const
inlinevirtual

Reimplemented from frepple::utils::DataElement.

Definition at line 2625 of file utils.h.

virtual long frepple::utils::XMLElement::getLong ( ) const
inlinevirtual

Reimplemented from frepple::utils::DataElement.

Definition at line 2619 of file utils.h.

virtual string frepple::utils::XMLElement::getString ( ) const
inlinevirtual

Returns the string value of the XML data. The xerces library takes care of appropriately unescaping special character sequences.

Reimplemented from frepple::utils::DataElement.

Definition at line 2633 of file utils.h.

virtual TimePeriod frepple::utils::XMLElement::getTimeperiod ( ) const
inlinevirtual

Reimplemented from frepple::utils::DataElement.

Definition at line 2623 of file utils.h.

virtual unsigned long frepple::utils::XMLElement::getUnsignedLong ( ) const
inlinevirtual

Reimplemented from frepple::utils::DataElement.

Definition at line 2621 of file utils.h.

virtual frepple::utils::XMLElement::operator bool ( ) const
inlinevirtual

Reimplemented from frepple::utils::DataElement.

Definition at line 2590 of file utils.h.

void frepple::utils::XMLElement::reset ( )
inline

Re-initializes an existing element. Using this method we can avoid destroying and recreating XMLelement objects too frequently. Instead we can manage them in a array.

Definition at line 2605 of file utils.h.

void frepple::utils::XMLElement::setData ( const char *  pData)
inline

Set the data value of this element.

Definition at line 2614 of file utils.h.


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