GEOSX
|
#include <xmlWrapper.hpp>
Public Types | |
using | xmlDocument = pugi::xml_document |
Alias for the type of xml document. | |
using | xmlResult = pugi::xml_parse_result |
Alias for the type of the result from an xml parse attempt. | |
using | xmlNode = pugi::xml_node |
Alias for the type of an xml node. | |
using | xmlAttribute = pugi::xml_attribute |
Alias for the type of an xml attribute. | |
using | xmlTypes = pugi::xml_node_type |
Alias for the type variant of an xml node. | |
Public Member Functions | |
IS_VALID_EXPRESSION (canParseVariable, T, StringToInputVariable(std::declval< T & >(), std::string())) | |
Constructors/destructor/assignment. | |
xmlWrapper ()=delete | |
Deleted default constructor. | |
~xmlWrapper ()=delete | |
Deleted default default destructor. | |
xmlWrapper (xmlWrapper const &)=delete | |
Deleted copy constructor. | |
xmlWrapper (xmlWrapper &&)=delete | |
Deleted move constructor. | |
Static Public Member Functions | |
static void | addIncludedXML (xmlNode &targetNode) |
Function to add xml nodes from included files. More... | |
String to variable parsing. | |
These functions take in | |
template<typename T > | |
static std::enable_if_t< traits::CanStreamInto< std::istringstream, T > > | StringToInputVariable (T &target, string const &value) |
Parse a string and fill a variable with the value(s) in the string. More... | |
static void | StringToInputVariable (R1Tensor &target, string const &value) |
Parse a string and fill a R1Tensor with the value(s) in the string. More... | |
template<typename T , int NDIM, typename PERMUTATION > | |
static std::enable_if_t< traits::CanStreamInto< std::istringstream, T > > | StringToInputVariable (Array< T, NDIM, PERMUTATION > &array, string const &value) |
Parse a string and fill an Array with the value(s) in the string. More... | |
Attribute extraction from XML nodes. | |
template<typename T , typename T_DEF = T> | |
static std::enable_if_t< canParseVariable< T >, bool > | ReadAttributeAsType (T &rval, string const &name, xmlNode const &targetNode, T_DEF const &defVal) |
Extract attribute in an xml tree, and translate its value into a typed variable. More... | |
template<typename T > | |
static std::enable_if_t< canParseVariable< T >, bool > | ReadAttributeAsType (T &rval, string const &name, xmlNode const &targetNode, bool const required) |
Extract attribute in an xml tree, and translate its value into a typed variable. More... | |
template<typename T > | |
static std::enable_if_t< !dataRepository::DefaultValue< T >::has_default_value, bool > | ReadAttributeAsType (T &rval, string const &name, xmlNode const &targetNode, dataRepository::DefaultValue< T > const &) |
Extract attribute in an xml tree, and translate its value into a typed variable. More... | |
template<typename T > | |
static std::enable_if_t< dataRepository::DefaultValue< T >::has_default_value, bool > | ReadAttributeAsType (T &rval, string const &name, xmlNode const &targetNode, dataRepository::DefaultValue< T > const &defVal) |
Extract attribute in an xml tree, and translate its value into a typed variable. More... | |
template<typename T , typename U > | |
static std::enable_if_t< !canParseVariable< T >, bool > | ReadAttributeAsType (T &, string const &, xmlNode const &, U const &) |
Stub that for unreadable types that errors out. More... | |
Static Public Attributes | |
static constexpr auto | filePathString = "filePath" |
constexpr variable to hold name for inserting the file path into the xml file. More... | |
This class wraps/provides facilities to process entries from an xml file into the appropriate data types. xmlWrapper provides some aliases that will wrap the underlying xml package being used to extract data from the xml file, and a set of static member functions that facilitate the parsing of string data from the xml into the variables that will hold those values in the code.
Definition at line 49 of file xmlWrapper.hpp.
|
static |
Function to add xml nodes from included files.
targetNode | the node for which to look for included children specifications |
This function looks for a "Included" node under the targetNode, loops over all subnodes under the "Included" node, and then parses the file specified in those subnodes taking all the nodes in the file and adding them to the targetNode.
geosx::xmlWrapper::IS_VALID_EXPRESSION | ( | canParseVariable | , |
T | , | ||
StringToInputVariable(std::declval< T &>(), std::string()) | |||
) |
Defines a static constexpr bool canParseVariable that is true iff the template parameter T is a valid argument to StringToInputVariable.
|
inlinestatic |
Extract attribute in an xml tree, and translate its value into a typed variable.
T | the type of variable fill with xml attribute. |
T_DEF | type of the default value for rval |
[out] | rval | the variable to fill with value |
[in] | name | the name of the xml attribute to process |
[in] | targetNode | the xml node that should contain the attribute |
[in] | defVal | default value of rval (or entries of rval , if it is an array) |
Definition at line 172 of file xmlWrapper.hpp.
|
inlinestatic |
Extract attribute in an xml tree, and translate its value into a typed variable.
T | the type of variable fill with xml attribute. |
[out] | rval | the variable to fill with value |
[in] | name | the name of the xml attribute to process |
[in] | targetNode | the xml node that should contain the attribute |
[in] | required | whether or not the value is required |
Definition at line 202 of file xmlWrapper.hpp.
|
inlinestatic |
Extract attribute in an xml tree, and translate its value into a typed variable.
T | the type of variable fill with xml attribute. |
[out] | rval | the variable to fill with value |
[in] | name | the name of the xml attribute to process |
[in] | targetNode | the xml node that should contain the attribute |
Definition at line 229 of file xmlWrapper.hpp.
|
inlinestatic |
Extract attribute in an xml tree, and translate its value into a typed variable.
T | the type of variable fill with xml attribute. |
[out] | rval | the variable to fill with value |
[in] | name | the name of the xml attribute to process |
[in] | targetNode | the xml node that should contain the attribute |
[in] | defVal | default value of rval (or entries of rval , if it is an array) |
Definition at line 246 of file xmlWrapper.hpp.
|
inlinestatic |
Stub that for unreadable types that errors out.
Definition at line 258 of file xmlWrapper.hpp.
|
inlinestatic |
Parse a string and fill a variable with the value(s) in the string.
T | the type of variable fill with string value |
[out] | target | the object to read values into |
[in] | value | the string that contains the data to be parsed into target |
Definition at line 122 of file xmlWrapper.hpp.
|
static |
Parse a string and fill a R1Tensor with the value(s) in the string.
[out] | target | the object to read values into |
[in] | value | the string that contains the data to be parsed into target |
|
inlinestatic |
Parse a string and fill an Array with the value(s) in the string.
T | data type of the array |
NDIM | number of dimensions of the array |
PERMUTATION | the permutation of the array |
[out] | array | the array to read values into |
[in] | value | the string that contains the data to be parsed into target |
Definition at line 146 of file xmlWrapper.hpp.
|
static |
constexpr variable to hold name for inserting the file path into the xml file.
This is used because we would like the option to hold the file path in the xml structure.
Definition at line 73 of file xmlWrapper.hpp.