Teuchos::XMLObject Class Reference

Representation of an XML data tree. XMLObject is a ref-counted handle to a XMLObjectImplem object, allowing storage by reference. More...

#include <Teuchos_XMLObject.hpp>

Collaboration diagram for Teuchos::XMLObject:

[legend]
List of all members.

Public Member Functions

Constructors
 XMLObject ()
 Empty constructor.
 XMLObject (const string &tag)
 Construct using a node labeled by tag.
 XMLObject (XMLObjectImplem *ptr)
 Construct with a pointer to the low-level representation.
Copy methods
XMLObject deepCopy () const
 Make a deep copy of this object.
Data Access methods
const string & getTag () const
 Return the tag of the current node.
bool hasAttribute (const string &name) const
 Find out if the current node has an attribute of the specified name.
const string & getAttribute (const string &name) const
 Return the value of the attribute with the specified name.
const string & getRequired (const string &name) const
 Get an attribute, throwing an exception if it is not found.
double getRequiredDouble (const string &name) const
 Get a required attribute, returning it as a double.
int getRequiredInt (const string &name) const
 Get a required attribute, returning it as an int.
bool getRequiredBool (const string &name) const
 Get a required attribute, returning it as a bool.
string getWithDefault (const string &name, const string &defaultValue) const
 Get an attribute, assigning a default value if the requested attribute does not exist.
int numChildren () const
 Return the number of child nodes owned by this node.
const XMLObjectgetChild (int i) const
 Return the i-th child node.
int numContentLines () const
 Return the number of lines of character content stored in this node.
const string & getContentLine (int i) const
 Return the i-th line of character content stored in this node.
string toString () const
 Represent this node and its children as a string.
string header () const
 Write the header for this object to a string.
string footer () const
 Write the footer for this object to a string.
bool isEmpty () const
 Find out if a node is empty.
void checkTag (const string &expected) const
 Check that a tag is equal to an expected string.
Tree-Assembly methods
void addAttribute (const string &name, const string &value)
 Add an attribute to the current node's atribute list.
void addDouble (const string &name, double val)
 Add a double as an attribute.
void addInt (const string &name, int val)
 Add an int as an attribute.
void addBool (const string &name, bool val)
 Add a bool as an attribute.
void addChild (const XMLObject &child)
 Add a child node to the node.
void addContent (const string &contentLine)
 Add a line of character content.

Private Attributes

RefCountPtr< XMLObjectImplemptr_

Related Functions

(Note that these are not member functions.)

ostream & operator<< (ostream &os, const XMLObject &xml)
 Write XMLObject to os stream.
string toString (const XMLObject &xml)
 Write XMLObject to string.

Detailed Description

Representation of an XML data tree. XMLObject is a ref-counted handle to a XMLObjectImplem object, allowing storage by reference.

Definition at line 47 of file Teuchos_XMLObject.hpp.


Constructor & Destructor Documentation

Teuchos::XMLObject::XMLObject  )  [inline]
 

Empty constructor.

Definition at line 54 of file Teuchos_XMLObject.hpp.

XMLObject::XMLObject const string &  tag  ) 
 

Construct using a node labeled by tag.

Definition at line 36 of file Teuchos_XMLObject.cpp.

XMLObject::XMLObject XMLObjectImplem ptr  ) 
 

Construct with a pointer to the low-level representation.

This is used to allow construction of an XMLObject from the XMLObjectImplem* return value of ExceptionBase::toXML().

Definition at line 40 of file Teuchos_XMLObject.cpp.


Member Function Documentation

XMLObject XMLObject::deepCopy  )  const
 

Make a deep copy of this object.

Definition at line 44 of file Teuchos_XMLObject.cpp.

const string& Teuchos::XMLObject::getTag  )  const [inline]
 

Return the tag of the current node.

Definition at line 79 of file Teuchos_XMLObject.hpp.

bool Teuchos::XMLObject::hasAttribute const string &  name  )  const [inline]
 

Find out if the current node has an attribute of the specified name.

Definition at line 82 of file Teuchos_XMLObject.hpp.

const string& Teuchos::XMLObject::getAttribute const string &  name  )  const [inline]
 

Return the value of the attribute with the specified name.

Definition at line 86 of file Teuchos_XMLObject.hpp.

const string & XMLObject::getRequired const string &  name  )  const
 

Get an attribute, throwing an exception if it is not found.

Definition at line 49 of file Teuchos_XMLObject.cpp.

double Teuchos::XMLObject::getRequiredDouble const string &  name  )  const [inline]
 

Get a required attribute, returning it as a double.

Definition at line 93 of file Teuchos_XMLObject.hpp.

int Teuchos::XMLObject::getRequiredInt const string &  name  )  const [inline]
 

Get a required attribute, returning it as an int.

Definition at line 97 of file Teuchos_XMLObject.hpp.

bool XMLObject::getRequiredBool const string &  name  )  const
 

Get a required attribute, returning it as a bool.

Definition at line 64 of file Teuchos_XMLObject.cpp.

string XMLObject::getWithDefault const string &  name,
const string &  defaultValue
const
 

Get an attribute, assigning a default value if the requested attribute does not exist.

Definition at line 57 of file Teuchos_XMLObject.cpp.

int Teuchos::XMLObject::numChildren  )  const [inline]
 

Return the number of child nodes owned by this node.

Definition at line 110 of file Teuchos_XMLObject.hpp.

const XMLObject& Teuchos::XMLObject::getChild int  i  )  const [inline]
 

Return the i-th child node.

Definition at line 113 of file Teuchos_XMLObject.hpp.

int Teuchos::XMLObject::numContentLines  )  const [inline]
 

Return the number of lines of character content stored in this node.

Definition at line 116 of file Teuchos_XMLObject.hpp.

const string& Teuchos::XMLObject::getContentLine int  i  )  const [inline]
 

Return the i-th line of character content stored in this node.

Definition at line 119 of file Teuchos_XMLObject.hpp.

string Teuchos::XMLObject::toString  )  const [inline]
 

Represent this node and its children as a string.

Definition at line 122 of file Teuchos_XMLObject.hpp.

string Teuchos::XMLObject::header  )  const [inline]
 

Write the header for this object to a string.

Definition at line 125 of file Teuchos_XMLObject.hpp.

string Teuchos::XMLObject::footer  )  const [inline]
 

Write the footer for this object to a string.

Definition at line 128 of file Teuchos_XMLObject.hpp.

bool Teuchos::XMLObject::isEmpty  )  const [inline]
 

Find out if a node is empty.

Definition at line 131 of file Teuchos_XMLObject.hpp.

void XMLObject::checkTag const string &  expected  )  const
 

Check that a tag is equal to an expected string.

Definition at line 88 of file Teuchos_XMLObject.cpp.

void Teuchos::XMLObject::addAttribute const string &  name,
const string &  value
[inline]
 

Add an attribute to the current node's atribute list.

Definition at line 141 of file Teuchos_XMLObject.hpp.

void Teuchos::XMLObject::addDouble const string &  name,
double  val
[inline]
 

Add a double as an attribute.

Definition at line 145 of file Teuchos_XMLObject.hpp.

void Teuchos::XMLObject::addInt const string &  name,
int  val
[inline]
 

Add an int as an attribute.

Definition at line 149 of file Teuchos_XMLObject.hpp.

void Teuchos::XMLObject::addBool const string &  name,
bool  val
[inline]
 

Add a bool as an attribute.

Definition at line 153 of file Teuchos_XMLObject.hpp.

void Teuchos::XMLObject::addChild const XMLObject child  )  [inline]
 

Add a child node to the node.

Definition at line 157 of file Teuchos_XMLObject.hpp.

void Teuchos::XMLObject::addContent const string &  contentLine  )  [inline]
 

Add a line of character content.

Definition at line 161 of file Teuchos_XMLObject.hpp.


Friends And Related Function Documentation

ostream & operator<< ostream &  os,
const XMLObject xml
[related]
 

Write XMLObject to os stream.

Definition at line 172 of file Teuchos_XMLObject.hpp.

string toString const XMLObject xml  )  [related]
 

Write XMLObject to string.

Definition at line 180 of file Teuchos_XMLObject.hpp.


Member Data Documentation

RefCountPtr<XMLObjectImplem> Teuchos::XMLObject::ptr_ [private]
 

Definition at line 166 of file Teuchos_XMLObject.hpp.


The documentation for this class was generated from the following files:
Generated on Thu Sep 18 12:42:54 2008 for Teuchos - Trilinos Tools Package by doxygen 1.3.9.1