preCICE v3.1.2
|
Represents an XML tag to be configured automatically. More...
#include <XMLTag.hpp>
Classes | |
struct | Listener |
Callback interface for configuration classes using XMLTag. More... | |
Public Types | |
enum | Occurrence { OCCUR_NOT_OR_ONCE , OCCUR_ONCE , OCCUR_ONCE_OR_MORE , OCCUR_ARBITRARY , OCCUR_ARBITRARY_NESTED } |
Types of occurrences of an XML tag. More... | |
using | Namespaces = typename std::vector<std::string> |
using | Subtags = typename std::vector<std::shared_ptr<XMLTag>> |
template<typename T > | |
using | AttributeMap = typename std::map<std::string, XMLAttribute<T>> |
Static Public Member Functions | |
static std::string | getOccurrenceString (Occurrence occurrence) |
Private Member Functions | |
void | areAllSubtagsConfigured () const |
void | resetAttributes () |
Private Attributes | |
logging::Logger | _log {"xml::XMLTag"} |
Listener & | _listener |
std::string | _name |
Name of the tag. | |
std::string | _namespace |
XML namespace of the tag. | |
std::string | _fullName |
Combination of name and namespace: _namespace + ":" + _name. | |
std::string | _doc |
bool | _configured = false |
Occurrence | _occurrence |
Namespaces | _namespaces |
Subtags | _subtags |
std::map< std::string, bool > | _configuredNamespaces |
std::set< std::string > | _attributes |
AttributeMap< double > | _doubleAttributes |
AttributeMap< int > | _intAttributes |
AttributeMap< std::string > | _stringAttributes |
AttributeMap< bool > | _booleanAttributes |
AttributeMap< Eigen::VectorXd > | _eigenVectorXdAttributes |
std::map< std::string, std::string > | _attributeHints |
Friends | |
class | precice::xml::ConfigParser |
Represents an XML tag to be configured automatically.
Definition at line 31 of file XMLTag.hpp.
using precice::xml::XMLTag::AttributeMap = typename std::map<std::string, XMLAttribute<T>> |
Definition at line 40 of file XMLTag.hpp.
Definition at line 35 of file XMLTag.hpp.
Definition at line 37 of file XMLTag.hpp.
Types of occurrences of an XML tag.
Enumerator | |
---|---|
OCCUR_NOT_OR_ONCE | |
OCCUR_ONCE | |
OCCUR_ONCE_OR_MORE | |
OCCUR_ARBITRARY | |
OCCUR_ARBITRARY_NESTED |
Definition at line 67 of file XMLTag.hpp.
precice::xml::XMLTag::XMLTag | ( | Listener & | listener, |
std::string | name, | ||
Occurrence | occurrence, | ||
std::string | xmlNamespace = "" ) |
Standard constructor.
[in] | listener | Configuration listener receiving callbacks from this tag. |
[in] | name | Name of the XML tag. |
[in] | occurrence | Defines the occurrences of the tag in the configuration. |
[in] | xmlNamespace | Defines a prefix/namespace for the tag. Tags with equal namespace or treated as group. |
Definition at line 12 of file XMLTag.cpp.
XMLTag & precice::xml::XMLTag::addAttribute | ( | const XMLAttribute< bool > & | attribute | ) |
Adds a XML attribute by making a copy of the given attribute.
Definition at line 83 of file XMLTag.cpp.
XMLTag & precice::xml::XMLTag::addAttribute | ( | const XMLAttribute< double > & | attribute | ) |
Removes the XML subtag with given name.
Adds a XML attribute by making a copy of the given attribute.
Definition at line 53 of file XMLTag.cpp.
XMLTag & precice::xml::XMLTag::addAttribute | ( | const XMLAttribute< Eigen::VectorXd > & | attribute | ) |
Adds a XML attribute by making a copy of the given attribute.
Definition at line 93 of file XMLTag.cpp.
XMLTag & precice::xml::XMLTag::addAttribute | ( | const XMLAttribute< int > & | attribute | ) |
XMLTag & precice::xml::XMLTag::addAttribute | ( | const XMLAttribute< std::string > & | attribute | ) |
Adds a XML attribute by making a copy of the given attribute.
Definition at line 73 of file XMLTag.cpp.
void precice::xml::XMLTag::addAttributeHint | ( | std::string | name, |
std::string | message ) |
Adds a hint for missing attributes, which will be displayed along the error message.
Definition at line 104 of file XMLTag.cpp.
XMLTag & precice::xml::XMLTag::addNamespace | ( | const std::string & | namespaceName | ) |
Adds a namespace to the tag.
Only used for outputting correct XML format, such that, e.g., internet browsers display no errors when viewing an XML configuration.
Definition at line 35 of file XMLTag.cpp.
Adds an XML tag as subtag by making a copy of the given tag.
Definition at line 41 of file XMLTag.cpp.
|
private |
void precice::xml::XMLTag::clear | ( | ) |
Removes all attributes and subtags.
Definition at line 374 of file XMLTag.cpp.
|
inline |
Definition at line 198 of file XMLTag.hpp.
bool precice::xml::XMLTag::getBooleanAttributeValue | ( | const std::string & | name, |
std::optional< bool > | default_value = std::nullopt ) const |
|
inline |
Definition at line 98 of file XMLTag.hpp.
|
inline |
Definition at line 183 of file XMLTag.hpp.
double precice::xml::XMLTag::getDoubleAttributeValue | ( | const std::string & | name, |
std::optional< double > | default_value = std::nullopt ) const |
|
inline |
Definition at line 203 of file XMLTag.hpp.
Eigen::VectorXd precice::xml::XMLTag::getEigenVectorXdAttributeValue | ( | const std::string & | name, |
int | dimensions ) const |
Returns Eigen vector attribute value with given dimensions.
If the parsed vector has less dimensions then required, an error message is thrown.
[in] | name | Name of attribute. |
[in] | dimensions | Dimensions of the vector to be returned. |
Definition at line 168 of file XMLTag.cpp.
|
inline |
Returns full name consisting of xml namespace + ":" + name.
Definition at line 170 of file XMLTag.hpp.
|
inline |
Definition at line 188 of file XMLTag.hpp.
int precice::xml::XMLTag::getIntAttributeValue | ( | const std::string & | name, |
std::optional< int > | default_value = std::nullopt ) const |
|
inline |
Returns name (without namespace).
The method getFullName() returns the name with namespace.
Definition at line 153 of file XMLTag.hpp.
|
inline |
Returns xml namespace.
Definition at line 159 of file XMLTag.hpp.
|
inline |
Definition at line 164 of file XMLTag.hpp.
|
inline |
Definition at line 226 of file XMLTag.hpp.
|
static |
Definition at line 411 of file XMLTag.cpp.
|
inline |
Definition at line 193 of file XMLTag.hpp.
std::string precice::xml::XMLTag::getStringAttributeValue | ( | const std::string & | name, |
std::optional< std::string > | default_value = std::nullopt ) const |
Definition at line 114 of file XMLTag.hpp.
bool precice::xml::XMLTag::hasAttribute | ( | const std::string & | attributeName | ) |
|
inline |
Definition at line 221 of file XMLTag.hpp.
void precice::xml::XMLTag::readAttributes | ( | const std::map< std::string, std::string > & | aAttributes | ) |
reads all attributes of this tag
Definition at line 190 of file XMLTag.cpp.
|
private |
XMLTag & precice::xml::XMLTag::setDocumentation | ( | const std::string & | documentation | ) |
Adds a description of the purpose of this XML tag.
The description and more information is printed with printDocumentation().
Definition at line 29 of file XMLTag.cpp.
Definition at line 32 of file XMLTag.hpp.
|
private |
Definition at line 275 of file XMLTag.hpp.
|
private |
Definition at line 263 of file XMLTag.hpp.
|
private |
Definition at line 271 of file XMLTag.hpp.
Definition at line 253 of file XMLTag.hpp.
|
private |
Definition at line 261 of file XMLTag.hpp.
|
private |
Definition at line 251 of file XMLTag.hpp.
|
private |
Definition at line 265 of file XMLTag.hpp.
|
private |
Definition at line 273 of file XMLTag.hpp.
|
private |
Combination of name and namespace: _namespace + ":" + _name.
Definition at line 249 of file XMLTag.hpp.
|
private |
Definition at line 267 of file XMLTag.hpp.
|
private |
Definition at line 240 of file XMLTag.hpp.
|
mutableprivate |
Definition at line 238 of file XMLTag.hpp.
|
private |
Name of the tag.
Definition at line 243 of file XMLTag.hpp.
|
private |
XML namespace of the tag.
Definition at line 246 of file XMLTag.hpp.
|
private |
Definition at line 257 of file XMLTag.hpp.
|
private |
Definition at line 255 of file XMLTag.hpp.
|
private |
Definition at line 269 of file XMLTag.hpp.
|
private |
Definition at line 259 of file XMLTag.hpp.