![]() |
aGrUM 3.2.0
a C++ library for (probabilistic) graphical models
|
A non-owning handle to an XML element, opaque over ticpp::Element. More...
#include <XmlDocument.h>
Public Member Functions | |
| XmlElement ()=default | |
| bool | isNull () const noexcept |
| XmlElement | firstChildElement (const std::string &tag) const |
| XmlElement | firstChildElement (const std::string &tag, bool throwIfNotFound) const |
| Returns a null XmlElement instead of throwing when throwIfNotFound is false. | |
| std::vector< XmlElement > | children (const std::string &tag) const |
| All direct children with this tag, in document order. | |
| std::string | textOrDefault (const std::string &defaultValue) const |
| std::string | attribute (const std::string &name) const |
| bool | attribute (const std::string &name, std::string *out, bool throwIfNotFound=false) const |
| Returns false instead of throwing when the attribute is missing and throwIfNotFound is false; *out is left untouched in that case. | |
Private Member Functions | |
| XmlElement (void *ticppElement) noexcept | |
Private Attributes | |
| void * | _handle_ = nullptr |
| opaque ticpp::Element*, never exposed | |
Friends | |
| class | XmlDocument |
A non-owning handle to an XML element, opaque over ticpp::Element.
Default-constructed (or returned by a failed non-throwing lookup) as null: check with isNull() before use.
Definition at line 89 of file XmlDocument.h.
|
default |
Referenced by children(), gum::XmlDocument::firstChildElement(), firstChildElement(), and firstChildElement().
|
inlineexplicitprivatenoexcept |
Definition at line 116 of file XmlDocument.h.
References _handle_.
| std::string gum::XmlElement::attribute | ( | const std::string & | name | ) | const |
| XmlException | if the attribute is missing. |
Definition at line 82 of file XmlDocument.cpp.
References gum::XmlException::XmlException(), and _handle_.
| bool gum::XmlElement::attribute | ( | const std::string & | name, |
| std::string * | out, | ||
| bool | throwIfNotFound = false ) const |
Returns false instead of throwing when the attribute is missing and throwIfNotFound is false; *out is left untouched in that case.
Definition at line 90 of file XmlDocument.cpp.
References gum::XmlException::XmlException(), and _handle_.
| std::vector< XmlElement > gum::XmlElement::children | ( | const std::string & | tag | ) | const |
All direct children with this tag, in document order.
Definition at line 66 of file XmlDocument.cpp.
References XmlElement(), and _handle_.
| XmlElement gum::XmlElement::firstChildElement | ( | const std::string & | tag | ) | const |
| XmlException | if no such child exists. |
Definition at line 52 of file XmlDocument.cpp.
References XmlElement(), gum::XmlException::XmlException(), and _handle_.
| XmlElement gum::XmlElement::firstChildElement | ( | const std::string & | tag, |
| bool | throwIfNotFound ) const |
Returns a null XmlElement instead of throwing when throwIfNotFound is false.
Definition at line 59 of file XmlDocument.cpp.
References XmlElement(), gum::XmlException::XmlException(), and _handle_.
|
inlinenoexcept |
| std::string gum::XmlElement::textOrDefault | ( | const std::string & | defaultValue | ) | const |
Definition at line 77 of file XmlDocument.cpp.
References _handle_, and gum::MultiDimFunctionGraph< float >::defaultValue.
|
friend |
|
private |
opaque ticpp::Element*, never exposed
Definition at line 118 of file XmlDocument.h.
Referenced by XmlElement(), attribute(), attribute(), children(), firstChildElement(), firstChildElement(), isNull(), and textOrDefault().