23 #ifndef __ccxx_XMLElement_hxx 24 #define __ccxx_XMLElement_hxx 71 void setAttribute(
const String& name,
const String& value);
81 void setAttribute(
const String& name,
int value);
91 void setAttribute(
const String& name,
const int64_t& value);
101 void setAttribute(
const String& name,
const double& value);
111 void setAttribute(
const String& name,
bool value);
141 const String& defaultValue =
"")
const;
154 bool getAttribute(
const String& name,
int& value,
int defaultValue = 0)
168 bool getAttribute(
const String& name, int64_t& value,
169 const int64_t& defaultValue = 0)
const;
182 bool getAttribute(
const String& name,
bool& value,
183 bool defaultValue =
false)
const;
196 bool getAttribute(
const String& name,
double& value,
197 const double& defaultValue = 0.0)
const;
204 void getAttributeNames(
StringVec& names)
const;
207 void removeAttributes();
215 bool hasAttributes()
const;
225 {
return(_content.getLength() > 0); }
233 { _content = content; }
241 {
return(_content); }
249 bool hasChildren()
const;
256 uint_t getChildCount()
const;
314 bool hasChild(
const String& name)
const;
345 {
return(_getChild(name)); }
356 {
return(_getChild(name)); }
376 const XMLElement& operator[](
int index)
const;
379 void removeChildren();
387 void removeChildren(
const String& name);
444 int64_t toInt64()
const;
447 uint64_t toUInt64()
const;
450 float toFloat()
const;
453 double toDouble()
const;
457 {
return(getContent()); }
461 {
return(_name.isNull()); }
464 inline operator const void*()
const 465 {
return(isNull() ? NULL :
this); }
469 {
return(isNull()); }
472 void write(std::ostream& stream,
int depth,
uint_t tabWidth)
const;
475 static void validateName(
const String& name);
488 class XMLAttributeMap;
490 XMLAttributeMap* _attrs;
504 #endif // __ccxx_XMLElement_hxx An XMLElement const iterator.
Definition: XMLElementConstIterator.h++:40
An XMLElement iterator.
Definition: XMLElementIterator.h++:40
bool isNull() const
Test if the element is a "null" element.
Definition: XMLElement.h++:460
const XMLElement & operator[](const String &name) const
Get the first child with the given name.
Definition: XMLElement.h++:344
A String vector.
Definition: String.h++:1159
String toString() const
Return the element's content as a String.
Definition: XMLElement.h++:456
String getName() const
Get the name of the element.
Definition: XMLElement.h++:60
#define COMMONCPPXML_API
Definition: Common.h++:129
An object representing an XML document.
Definition: XMLDocument.h++:46
bool operator!() const
Test if the element is a "null" element.
Definition: XMLElement.h++:468
unsigned int uint_t
An alias for unsigned int.
Definition: Integers.h++:74
An object representing an XML element.
Definition: XMLElement.h++:51
const String getContent() const
Get the element's content.
Definition: XMLElement.h++:240
void setContent(const String &content)
Set the element's content.
Definition: XMLElement.h++:232
static XMLElement null
The "null" element.
Definition: XMLElement.h++:478
A flexible, reference counted, copy-on-write, thread-safe, nullable string.
Definition: String.h++:50
#define CCXX_COPY_DECLS(CLASS)
Inlines declarations of a copy constructor and assignment operator for the class CLASS.
Definition: Common.h++:295
static const String null
The null string.
Definition: String.h++:1128
Definition: AllocationMap.c++:25
const XMLElement & operator[](const char *name) const
Get the first child with the given name.
Definition: XMLElement.h++:355
bool hasContent() const
Test if the element has content.
Definition: XMLElement.h++:224