#include <cppdom.h>
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 |
Definition at line 325 of file cppdom.h.
|
|
ctor.
Definition at line 255 of file cppdom.cpp.
00256 {}
|
|
|
Get the named attribute.
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 }
|
|
|
Check if the attribute map has the given attribute.
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 }
|
|
||||||||||||
|
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 }
|
|
|
|
1.2.15