GEOS
Classes | Namespaces | Typedefs | Functions | Variables
xmlWrapper.hpp File Reference
#include "common/DataTypes.hpp"
#include "DefaultValue.hpp"
#include "common/GEOS_RAJA_Interface.hpp"
#include "LvArray/src/output.hpp"
#include "LvArray/src/input.hpp"
#include "common/format/StringUtilities.hpp"
#include "codingUtilities/RTTypes.hpp"
#include <pugixml.hpp>
#include <algorithm>
#include <sstream>

Go to the source code of this file.

Classes

struct  geos::xmlWrapper::xmlAttributePos
 
struct  geos::xmlWrapper::xmlNodePos
 
class  geos::xmlWrapper::xmlDocument
 

Namespaces

 geos
 
 geos::xmlWrapper
 

Typedefs

using geos::xmlWrapper::xmlResult = pugi::xml_parse_result
 Alias for the type of the result from an xml parse attempt.
 
using geos::xmlWrapper::xmlNode = pugi::xml_node
 
using geos::xmlWrapper::xmlAttribute = pugi::xml_attribute
 
using geos::xmlWrapper::xmlNodeType = pugi::xml_node_type
 Alias for the type variant of an xml node.
 

Functions

string geos::xmlWrapper::buildMultipleInputXML (string_array const &inputFileList, string const &outputDir={})
 Function to handle multiple input xml files. More...
 
bool geos::xmlWrapper::isFileMetadataAttribute (string const &name)
 
String to variable parsing.

These functions take in value and parse that string based on the type of target. The function implementation should provide sufficient error checking in the case that value is formatted incorrectly for the type specified in target.

void geos::xmlWrapper::validateString (string const &value, Regex const &regex)
 
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. More...
 
template<typename T >
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. More...
 
template<typename T , int SIZE>
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. More...
 
template<typename T , int NDIM, typename PERMUTATION >
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. More...
 
Attribute extraction from XML nodes.
template<typename T , typename U >
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. More...
 
template<typename T , typename T_DEF = T>
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. More...
 
template<typename T >
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. More...
 
template<typename T >
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. More...
 
template<typename T >
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. More...
 

Variables

constexpr char const geos::xmlWrapper::filePathString [] = "__filePath__"
 constexpr variable to hold name for inserting the file path into the xml file. More...
 
constexpr char const geos::xmlWrapper::charOffsetString [] = "__charOffset__"
 constexpr variable to hold node character offset from the start of the xml file. More...
 
constexpr char const geos::xmlWrapper::includedListTag [] = "Included"
 XML tag name for included sections.
 
constexpr char const geos::xmlWrapper::includedFileTag [] = "File"
 XML tag name for included files.