GEOS
|
Classes | |
struct | xmlAttributePos |
struct | xmlNodePos |
class | xmlDocument |
Typedefs | |
using | xmlResult = pugi::xml_parse_result |
Alias for the type of the result from an xml parse attempt. | |
using | xmlNode = pugi::xml_node |
using | xmlAttribute = pugi::xml_attribute |
using | xmlNodeType = pugi::xml_node_type |
Alias for the type variant of an xml node. | |
Functions | |
string | buildMultipleInputXML (string_array const &inputFileList, string const &outputDir={}) |
Function to handle multiple input xml files. More... | |
bool | isFileMetadataAttribute (string const &name) |
String to variable parsing. | |
These functions take in | |
void | validateString (string const &value, Regex const ®ex) |
void | processInputException (std::exception const &ex, string const &targetAttributeName, xmlWrapper::xmlNode const &targetNode, xmlWrapper::xmlNodePos const &nodePos) |
Helper method to process an exception that has been thrown during xml parsing. More... | |
template<typename T > | |
std::enable_if_t< traits::CanStreamInto< std::istringstream, T > > | stringToInputVariable (T &target, string const &value, Regex const ®ex) |
Parse a string and fill a variable with the value(s) in the string. More... | |
template<typename T , int SIZE> | |
void | stringToInputVariable (Tensor< T, SIZE > &target, string const &value, Regex const ®ex) |
Parse a string and fill a R1Tensor with the value(s) in the string. More... | |
template<typename T , int NDIM, typename PERMUTATION > | |
std::enable_if_t< traits::CanStreamInto< std::istringstream, T > > | stringToInputVariable (Array< T, NDIM, PERMUTATION > &array, string const &value, Regex const ®ex) |
Parse a string and fill an Array with the value(s) in the string. More... | |
Attribute extraction from XML nodes. | |
template<typename T , typename U > | |
std::enable_if_t< !internal::canParseVariable< T >, bool > | readAttributeAsType (T &, string const &name, Regex const &, xmlNode const &, U const &) |
Extract attribute in an xml tree, and translate its value into a typed variable. This SFINAE implementation is used if the value is not parsable. More... | |
template<typename T , typename T_DEF = T> | |
std::enable_if_t< internal::canParseVariable< T >, bool > | readAttributeAsType (T &rval, string const &name, Regex const ®ex, 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 > | |
std::enable_if_t< internal::canParseVariable< T >, bool > | readAttributeAsType (T &rval, string const &name, Regex const ®ex, xmlNode const &targetNode, bool const required) |
Extract attribute in an xml tree, and translate its value into a typed variable. More... | |
template<typename T > | |
std::enable_if_t< !dataRepository::DefaultValue< T >::has_default_value, bool > | readAttributeAsType (T &rval, string const &name, Regex const ®ex, 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 > | |
std::enable_if_t< dataRepository::DefaultValue< T >::has_default_value, bool > | readAttributeAsType (T &rval, string const &name, Regex const ®ex, xmlNode const &targetNode, dataRepository::DefaultValue< T > const &defVal) |
Extract attribute in an xml tree, and translate its value into a typed variable. More... | |
Variables | |
constexpr char const | filePathString [] = "__filePath__" |
constexpr variable to hold name for inserting the file path into the xml file. More... | |
constexpr char const | charOffsetString [] = "__charOffset__" |
constexpr variable to hold node character offset from the start of the xml file. More... | |
constexpr char const | includedListTag [] = "Included" |
XML tag name for included sections. | |
constexpr char const | includedFileTag [] = "File" |
XML tag name for included files. | |
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 functions that facilitate the parsing of string data from the xml into the variables that will hold those values in the code.
using geos::xmlWrapper::xmlAttribute = typedef pugi::xml_attribute |
Alias for the type of an xml attribute. An xmlAttribute behave as a pointer object: passing it by value to a function which modify it will modify the original xmlAttribute object.
Definition at line 64 of file xmlWrapper.hpp.
using geos::xmlWrapper::xmlNode = typedef pugi::xml_node |
Alias for the type of an xml node. An xmlNode behave as a pointer object: passing it by value to a function which modify it will modify the original xmlNode object.
Definition at line 59 of file xmlWrapper.hpp.
string geos::xmlWrapper::buildMultipleInputXML | ( | string_array const & | inputFileList, |
string const & | outputDir = {} |
||
) |
Function to handle multiple input xml files.
inputFileList | the list of input xml files |
outputDir | the output directory to place the composite input file in |
This function checks for multiple xml files, and will build a new input xml file with an included block if neccesary
bool geos::xmlWrapper::isFileMetadataAttribute | ( | string const & | name | ) |
name | the name of an attribute |
void geos::xmlWrapper::processInputException | ( | std::exception const & | ex, |
string const & | targetAttributeName, | ||
xmlWrapper::xmlNode const & | targetNode, | ||
xmlWrapper::xmlNodePos const & | nodePos | ||
) |
Helper method to process an exception that has been thrown during xml parsing.
ex | The caught exception. |
targetAttributeName | The name of the attribute in which an input exception occured. |
targetNode | The node from which this Group is interpreted. |
nodePos | the target node position. |
An | InputError with the node & attribut info, including the nearest xml line possible. |
std::enable_if_t< !internal::canParseVariable< T >, bool > geos::xmlWrapper::readAttributeAsType | ( | T & | , |
string const & | name, | ||
Regex const & | , | ||
xmlNode const & | , | ||
U const & | |||
) |
Extract attribute in an xml tree, and translate its value into a typed variable. This SFINAE implementation is used if the value is not parsable.
T | the type of variable fill with xml attribute. |
U | type of the default value for rval |
[in] | name | the name of the xml attribute to process |
An | InputError if the string value could not be validated by the type regex or parsed to the destination type. In the context of xml parsing, use processInputException to format this error with the proper xml line. |
Definition at line 446 of file xmlWrapper.hpp.
std::enable_if_t< internal::canParseVariable< T >, bool > geos::xmlWrapper::readAttributeAsType | ( | T & | rval, |
string const & | name, | ||
Regex const & | regex, | ||
xmlNode const & | targetNode, | ||
bool const | required | ||
) |
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] | regex | the regular expression used for validating the string value. |
[in] | targetNode | the xml node that should contain the attribute |
[in] | required | whether or not the value is required |
An | InputError if the string value could not be validated by the type regex or parsed to the destination type. In the context of xml parsing, use processInputException to format this error with the proper xml line. |
Definition at line 501 of file xmlWrapper.hpp.
std::enable_if_t< !dataRepository::DefaultValue< T >::has_default_value, bool > geos::xmlWrapper::readAttributeAsType | ( | T & | rval, |
string const & | name, | ||
Regex const & | regex, | ||
xmlNode const & | targetNode, | ||
dataRepository::DefaultValue< T > const & | |||
) |
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] | regex | the regular expression used for validating the string value. |
[in] | targetNode | the xml node that should contain the attribute |
An | InputError if the string value could not be validated by the type regex or parsed to the destination type. In the context of xml parsing, use processInputException to format this error with the proper xml line. |
Definition at line 532 of file xmlWrapper.hpp.
std::enable_if_t< dataRepository::DefaultValue< T >::has_default_value, bool > geos::xmlWrapper::readAttributeAsType | ( | T & | rval, |
string const & | name, | ||
Regex const & | regex, | ||
xmlNode const & | targetNode, | ||
dataRepository::DefaultValue< T > const & | defVal | ||
) |
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] | regex | the regular expression used for validating the string value. |
[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) |
An | InputError if the string value could not be validated by the type regex or parsed to the destination type. In the context of xml parsing, use processInputException to format this error with the proper xml line. |
Definition at line 555 of file xmlWrapper.hpp.
std::enable_if_t< internal::canParseVariable< T >, bool > geos::xmlWrapper::readAttributeAsType | ( | T & | rval, |
string const & | name, | ||
Regex const & | regex, | ||
xmlNode const & | targetNode, | ||
T_DEF const & | defVal | ||
) |
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] | regex | the regular expression used for validating the string value. |
[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) |
An | InputError if the string value could not be validated by the type regex or parsed to the destination type. In the context of xml parsing, use processInputException to format this error with the proper xml line. |
Definition at line 466 of file xmlWrapper.hpp.
std::enable_if_t< traits::CanStreamInto< std::istringstream, T > > geos::xmlWrapper::stringToInputVariable | ( | Array< T, NDIM, PERMUTATION > & | array, |
string const & | value, | ||
Regex const & | regex | ||
) |
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 |
[in] | regex | the regular expression used for validating the string value. |
An | InputError if the string value could not be validated by the type regex or parsed to the destination type. In the context of xml parsing, use processInputException to format this error with the proper xml line. |
Definition at line 389 of file xmlWrapper.hpp.
std::enable_if_t< traits::CanStreamInto< std::istringstream, T > > geos::xmlWrapper::stringToInputVariable | ( | T & | target, |
string const & | value, | ||
Regex const & | regex | ||
) |
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 |
[in] | regex | the regular expression used for validating the string value. |
An | InputError if the string value could not be validated by the type regex or parsed to the destination type. In the context of xml parsing, use processInputException to format this error with the proper xml line. |
Definition at line 351 of file xmlWrapper.hpp.
void geos::xmlWrapper::stringToInputVariable | ( | Tensor< T, SIZE > & | target, |
string const & | value, | ||
Regex const & | regex | ||
) |
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 |
[in] | regex | the regular expression used for validating the string value. |
An | InputError if the string value could not be validated by the type regex or parsed to the destination type. In the context of xml parsing, use processInputException to format this error with the proper xml line. |
void geos::xmlWrapper::validateString | ( | string const & | value, |
Regex const & | regex | ||
) |
An | InputError if the string value could not be validated with the provided regular expression. In the context of xml parsing, use processInputException to format this error with the proper xml line. |
value | The string to validate |
regex | The regular expression used for validating the string value. |
|
constexpr |
constexpr variable to hold node character offset from the start of the xml file.
This is used because we would like the option to hold the offset in the xml structure. The name is uglified with underscores to avoid collisions with real attribute names.
Definition at line 284 of file xmlWrapper.hpp.
|
constexpr |
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. The name is uglified with underscores to avoid collisions with real attribute names.
Definition at line 276 of file xmlWrapper.hpp.