ls1-MarDyn
ls1-MarDyn molecular dynamics code
|
XML file abstraction. More...
#include <xmlfile.h>
Classes | |
class | Node |
class | Query |
Public Member Functions | |
XMLfile () | |
XMLfile default constructor. | |
virtual | ~XMLfile () |
XMLfile default destructor. | |
XMLfile (const std::string &filepath) | |
constructor for XML-file constructor calls initfile More... | |
bool | initfile (const std::string &filepath) |
initialize with XML-file instantiating with XML file More... | |
void | initstring (const char *xmlstring) |
initialize with XML-string instantiating with XML-string More... | |
const std::string | getDir () const |
get XML file directory if instantiated with a XML-file, return the directory More... | |
const std::string | getFilename () const |
get XML filename if instantiated with a XML-file, return the filename (without directory part of path) More... | |
long | changecurrentnode (const std::string &nodepath=std::string("/")) |
set current node set a node, relative queries start with More... | |
bool | changecurrentnode (const Query::const_iterator &pos) |
set current node set a node, relative queries start with More... | |
std::string | getcurrentnodepath () const |
get current node path More... | |
template<typename T > | |
unsigned long | getNodeValue (const std::string &nodepath, T &value) const |
get node value get the node content and convert it to a given type More... | |
template<typename T > | |
unsigned long | getNodeValue (const char *nodepath, T &value) const |
get node value get the node content and convert it to a given type More... | |
std::string | getNodeValue_string (const std::string &nodepath, const std::string defaultvalue=std::string()) const |
get node value as string get the node content More... | |
std::string | getNodeValue_string (const char *nodepath, std::string defaultvalue=std::string()) const |
get node value as string get the node content More... | |
int | getNodeValue_int (const std::string &nodepath, int defaultvalue=0) const |
get node value as int get the node content and convert it to an integer More... | |
int | getNodeValue_int (const char *nodepath, int defaultvalue=0) const |
get node value as int get the node content and convert it to an integer More... | |
long | getNodeValue_long (const std::string &nodepath, long defaultvalue=0) const |
get node value as long get the node content and convert it to a long More... | |
long | getNodeValue_long (const char *nodepath, long defaultvalue=0) const |
get node value as long get the node content and convert it to a long More... | |
float | getNodeValue_float (const std::string &nodepath, float defaultvalue=0.) const |
get node value as float get the node content and convert it to a float More... | |
float | getNodeValue_float (const char *nodepath, float defaultvalue=0.) const |
get node value as float get the node content and convert it to a float More... | |
double | getNodeValue_double (const std::string &nodepath, double defaultvalue=0.) const |
get node value as double get the node content and convert it to a double More... | |
double | getNodeValue_double (const char *nodepath, double defaultvalue=0.) const |
get node value as double get the node content and convert it to a double More... | |
bool | getNodeValue_bool (const std::string &nodepath, bool defaultvalue=false) const |
get node value as bool get the node content and convert it to a bool (an alternative of using <tag>true</tag> is to look for an occurance of an empty element like <tag>) More... | |
bool | getNodeValue_bool (const char *nodepath, bool defaultvalue=false) const |
get node value as bool get the node content and convert it to a bool More... | |
void | printXML (std::ostream &ostrm=std::cout) const |
print node content as XML print node content to stream using XML More... | |
void | print (std::ostream &ostrm=std::cout) const |
print node content print node content and debug information to stream More... | |
void | save (std::string filepath=std::string()) |
save save node content as XML-file More... | |
Query | query (const std::string &querystr) const |
perform a query return a query to a given query expression More... | |
operator std::string () const | |
std::string cast operator XMLfile will cast to a string with XML content | |
size_t | numqueries () const |
number of registered queries return the number of active queries More... | |
void | setMPIdefaults (int mpirootrank=0, MPI_Comm mpicomm=MPI_COMM_WORLD) |
Static Public Attributes | |
static const char *const | includeattrtag = "include" |
static const char *const | queryattrtag = "query" |
Friends | |
void | Query::xmlfile_register () |
void | Query::xmlfile_unregister () |
XML file abstraction.
DOM representation of an XML file
XMLfile::XMLfile | ( | const std::string & | filepath | ) |
constructor for XML-file constructor calls initfile
std::string& | XML-file |
bool XMLfile::changecurrentnode | ( | const Query::const_iterator & | pos | ) |
set current node set a node, relative queries start with
Query::const_iterator& | query iterator pointing to a node |
long XMLfile::changecurrentnode | ( | const std::string & | nodepath = std::string("/") | ) |
set current node set a node, relative queries start with
std::string& | node path (default: "/") |
|
inline |
get current node path
|
inline |
get XML file directory if instantiated with a XML-file, return the directory
|
inline |
get XML filename if instantiated with a XML-file, return the filename (without directory part of path)
|
inline |
get node value get the node content and convert it to a given type
const | char* nodepath |
T& | variable to return value |
|
inline |
get node value get the node content and convert it to a given type
std::string& | nodepath |
T& | variable to return value |
|
inline |
get node value as bool get the node content and convert it to a bool
const | char* nodepath |
bool& | default value to return, if node is not found |
|
inline |
get node value as bool get the node content and convert it to a bool (an alternative of using <tag>true</tag> is to look for an occurance of an empty element like <tag>)
std::string& | nodepath |
bool& | default value to return, if node is not found |
|
inline |
get node value as double get the node content and convert it to a double
const | char* nodepath |
double& | default value to return, if node is not found |
|
inline |
get node value as double get the node content and convert it to a double
std::string& | nodepath |
double& | default value to return, if node is not found |
|
inline |
get node value as float get the node content and convert it to a float
const | char* nodepath |
float& | default value to return, if node is not found |
|
inline |
get node value as float get the node content and convert it to a float
std::string& | nodepath |
float& | default value to return, if node is not found |
|
inline |
get node value as int get the node content and convert it to an integer
const | char* nodepath |
int& | default value to return, if node is not found |
|
inline |
get node value as int get the node content and convert it to an integer
std::string& | nodepath |
int& | default value to return, if node is not found |
|
inline |
get node value as long get the node content and convert it to a long
const | char* nodepath |
long& | default value to return, if node is not found |
|
inline |
get node value as long get the node content and convert it to a long
std::string& | nodepath |
long& | default value to return, if node is not found |
|
inline |
get node value as string get the node content
const | char* nodepath |
std::string& | default value to return, if node is not found |
|
inline |
get node value as string get the node content
std::string& | nodepath |
std::string& | default value to return, if node is not found |
bool XMLfile::initfile | ( | const std::string & | filepath | ) |
initialize with XML-file instantiating with XML file
std::string& | XML-file |
void XMLfile::initstring | ( | const char * | xmlstring | ) |
initialize with XML-string instantiating with XML-string
const | char* XML-string |
|
inline |
number of registered queries return the number of active queries
void XMLfile::print | ( | std::ostream & | ostrm = std::cout | ) | const |
print node content print node content and debug information to stream
std::ostrm& | output stream |
void XMLfile::printXML | ( | std::ostream & | ostrm = std::cout | ) | const |
print node content as XML print node content to stream using XML
std::ostrm& | output stream |
Query XMLfile::query | ( | const std::string & | querystr | ) | const |
perform a query return a query to a given query expression
std::string& | query string |
void XMLfile::save | ( | std::string | filepath = std::string() | ) |
save save node content as XML-file
std::string& | output file |