Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

cppdom::XMLAttribute Class Reference

XML attribute class. More...

#include <cppdom.h>

List of all members.

Public Methods

 XMLAttribute ()
 XMLAttribute (const XMLAttribute &attr)
 XMLAttribute (const std::string &val)
template<class T>  XMLAttribute (const T &val)
const std::string & getString () const
template<class T> void setValue (const T &val)
 Set mData to the string value of val. More...

template<class T> T getValue () const
 operator std::string () const
 Autoconversion to string (so old code should work). More...

Protected Attributes

std::string mData

Detailed Description

XML attribute class.

Just wraps a string (this is really just and attribute VALUE)

Definition at line 246 of file cppdom.h.

Constructor & Destructor Documentation


Definition at line 231 of file cppdom.cpp.

00232       : mData("")
00233    {}

cppdom::XMLAttribute::XMLAttribute const XMLAttribute &    attr

Definition at line 235 of file cppdom.cpp.

00236       : mData(attr.mData)
00237    {}

cppdom::XMLAttribute::XMLAttribute const std::string &    val

Definition at line 239 of file cppdom.cpp.

00240       : mData(val)
00241    {}

template<class T>
cppdom::XMLAttribute::XMLAttribute const T &    val [inline]

Definition at line 255 of file cppdom.h.

00256       {
00257          setValue<T>(val);
00258       }

Member Function Documentation

const std::string & cppdom::XMLAttribute::getString   const

Definition at line 243 of file cppdom.cpp.

References mData.

Referenced by operator std::string(), and cppdom::XMLNode::setAttribute().

00244    {
00245       return mData;
00246    }

std::string cppdom::XMLAttribute::getValue< std::string >   const [inline]

Definition at line 277 of file cppdom.h.

00278       {
00279          T t;
00280          std::istringstream iss(mData);
00281          iss >> t;
00282          return t;
00283       }

cppdom::XMLAttribute::operator std::string   const

Autoconversion to string (so old code should work).

Definition at line 248 of file cppdom.cpp.

References getString().

00249    {
00250       return getString();
00251    }

template<class T>
void cppdom::XMLAttribute::setValue const T &    val [inline]

Set mData to the string value of val.

Requires a stream operation of type T

Definition at line 269 of file cppdom.h.

00270       {
00271          std::ostringstream oss;
00272          oss << val;
00273          mData = oss.str();
00274       }

Member Data Documentation

std::string cppdom::XMLAttribute::mData [protected]

Definition at line 306 of file cppdom.h.

Referenced by getString().

The documentation for this class was generated from the following files:
Generated on Thu Jan 2 21:29:20 2003 for cppdom by doxygen1.2.15