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

cppdom::XMLAttributes Class Reference

xml tag attribute map contains all attributes and values a tag has, represented in a map. More...

#include <cppdom.h>

List of all members.

Public Methods

 XMLAttributes ()
 ctor. More...

std::string get (const std::string &key) const
 Get the named attribute. More...

void set (const std::string &key, const std::string &value)
 Sets new attribute value If not found, then just insert the new attribute. More...

bool has (const std::string &key) const
 Check if the attribute map has the given attribute. More...


Friends

class XMLParser


Detailed Description

xml tag attribute map contains all attributes and values a tag has, represented in a map.

Definition at line 325 of file cppdom.h.


Constructor & Destructor Documentation

cppdom::XMLAttributes::XMLAttributes  
 

ctor.

Definition at line 255 of file cppdom.cpp.

00256    {}


Member Function Documentation

std::string cppdom::XMLAttributes::get const std::string &    key const
 

Get the named attribute.

Returns:
empty string "" if not found, else the value

Definition at line 258 of file cppdom.cpp.

Referenced by cppdom::XMLNode::getAttribute().

00259    {
00260       XMLAttributes::const_iterator iter;
00261 
00262       // try to find the key in the map
00263       iter = find(key);
00264       std::string empty("");
00265       return ((iter == end()) ? empty : iter->second);
00266    }

bool cppdom::XMLAttributes::has const std::string &    key const
 

Check if the attribute map has the given attribute.

Returns:
false if not found

Definition at line 286 of file cppdom.cpp.

Referenced by cppdom::XMLNode::hasAttribute().

00287    {
00288       XMLAttributes::const_iterator iter;
00289 
00290       // try to find the key in the map
00291       iter = find(key);
00292       return (iter != end());
00293    }

void cppdom::XMLAttributes::set const std::string &    key,
const std::string &    value
 

Sets new attribute value If not found, then just insert the new attribute.

Definition at line 268 of file cppdom.cpp.

Referenced by cppdom::XMLNode::setAttribute().

00269    {
00270       XMLAttributes::iterator iter;
00271 
00272       // try to find the key in the map
00273       iter = find(key);
00274       if (iter != end())
00275       {
00276          (*iter).second = value;
00277       }
00278       else
00279       {
00280          // insert, because the key-value pair was not found
00281          XMLAttributes::value_type pa(key,value);
00282          insert(pa);
00283       }
00284    }


Friends And Related Function Documentation

friend class XMLParser [friend]
 

Definition at line 327 of file cppdom.h.


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