NSCL DDAS  1.0
Support for XIA DDAS at the NSCL
 All Classes Namespaces Files Functions Variables Macros Pages
Functions
tinyxmlutil.h File Reference

: Provide common utilities for working with Tinyxml2 More...

#include <tinyxml2.h>

Go to the source code of this file.

Functions

template<class T >
void readValue (T &result, tinyxml2::XMLElement &container)
 
void getAttribute (uint32_t &result, tinyxml2::XMLElement &container, const char *att)
 
void getAttribute (double &result, tinyxml2::XMLElement &container, const char *att)
 
void getAttribute (bool &result, tinyxml2::XMLElement &container, const char *att)
 
tinyxml2::XMLElementhaveChild (tinyxml2::XMLElement &parent, const char *element)
 
void checkXmlError (tinyxml2::XMLError err, tinyxml2::XMLDocument &doc)
 

Detailed Description

: Provide common utilities for working with Tinyxml2

Function Documentation

void checkXmlError ( tinyxml2::XMLError  err,
tinyxml2::XMLDocument doc 
)

checkXmlError IF the XML status passed in is not normal, throw an std::invalid_argument with as detailed a message as possible.

Parameters
err- XMLError which, hopefully is success.
doc- Reference to the document.
void getAttribute ( uint32_t &  result,
tinyxml2::XMLElement container,
const char *  att 
)

Various overloads for getAttribute that call the appropriate QueryxxxAttribute.

Parameters
result– where to put the reulst, this type varies.
container- the container to query.
att- attribute name (e.g. "value").
tinyxml2::XMLElement* haveChild ( tinyxml2::XMLElement parent,
const char *  element 
)

haveChild Checks for and returns a required child element

Parameters
parent- the parent that's required to have the child.
element- the name of the element.
Returns
tinyxml2::XMLElement* - pointer to the element.
Exceptions
std::invalid_argumentif the elmeent does not exist.
template<class T >
void readValue ( T &  result,
tinyxml2::XMLElement container 
)

readValue Gets the contents of a "value" attribute in an element/tag.

Parameters
dest- templated type reference to where this is stored.
container- Element that contains the "value" attribute.