LocalGuidance
A library that generates velocity references to follow a path.
tinyxml_tools::DocumentHandleXML Class Reference

#include <DocumentHandleXML.hpp>

Inheritance diagram for tinyxml_tools::DocumentHandleXML:
Inheritance graph

Public Member Functions

 DocumentHandleXML ()
 Default ctor. More...
 
 ~DocumentHandleXML () override=default
 Default dtor. More...
 
TiXmlHandle getRootHandle ()
 
TiXmlHandle getDocumentHandle ()
 
bool create (const std::string &path, DocumentMode mode) override
 Opens or creates a file at 'path' in depending on 'mode'. More...
 
bool create (const std::string &path, DocumentMode mode, const std::string &rootName)
 
bool merge (const std::string &path, MergeMode mode) override
 Merges file at 'path' with the handled document. More...
 
bool saveAs (const std::string &path, bool force) override
 Saves the current configuration to 'path'. More...
 
bool seek (std::string handle)
 
bool seekFromRoot (const std::string &handle)
 
void reset ()
 
template<typename T , typename U = T, typename = typename std::enable_if<!std::is_const<T>::value && std::is_convertible<U, T>::value>::type>
bool read (const std::string &name, T &value, const typename traits::element< T >::stringType &attributeName=traits::element< T >::getDefaultName(), const U &defaultValue=traits::element< T >::getDefaultValue()) const
 
template<typename T , typename U = T, typename = typename std::enable_if<!std::is_const<T>::value && std::is_convertible<U, T>::value>::type>
bool readAttributes (T &value, const typename traits::element< T >::stringType &attributeName=traits::element< T >::getDefaultName(), const U &defaultValue=traits::element< T >::getDefaultValue()) const
 
template<typename T , typename = typename std::enable_if<!std::is_const<T>::value>>
bool readSiblings (const std::string &name, T &value, const typename traits::element< T >::siblingStringType &attributeName=traits::element< typename traits::element< T >::siblingType >::getDefaultName(), const typename traits::element< T >::siblingType &defaultValue=traits::element< typename traits::element< T >::siblingType >::getDefaultValue()) const
 
template<typename T , typename = typename std::enable_if<!std::is_const<T>::value>>
bool readSiblingAttributes (T &value, const typename traits::element< T >::siblingStringType &attributeName=traits::element< typename traits::element< T >::siblingType >::getDefaultName(), const typename traits::element< T >::siblingType &defaultValue=traits::element< typename traits::element< T >::siblingType >::getDefaultValue()) const
 
template<typename T >
bool write (const std::string &name, const T &value, const typename traits::element< T >::stringType &attributeName=traits::element< T >::getDefaultName())
 
template<typename T >
bool writeAttributes (const T &value, const typename traits::element< T >::stringType &attributeName=traits::element< T >::getDefaultName())
 
template<typename T >
bool writeSiblings (const std::string &name, const T &value, const typename traits::element< T >::siblingStringType &attributeName=traits::element< typename traits::element< T >::siblingType >::getDefaultName())
 
- Public Member Functions inherited from tinyxml_tools::DocumentHandle
 DocumentHandle ()
 Default ctor. More...
 
virtual ~DocumentHandle ()=default
 Default dtor. More...
 
bool save ()
 Saves the current configuration to the file specified in create() More...
 

Protected Member Functions

bool resolveDefault ()
 
bool resolveIncludes ()
 
bool resolveExtensions ()
 
std::string convertPath (const std::string &path)
 
bool merge (const std::string &path, MergeMode mode, bool force)
 
bool mergeTrees (TiXmlHandle tree1, TiXmlHandle tree2, MergeMode mode)
 
void findElements (std::vector< TiXmlHandle > &handles, TiXmlHandle tree, std::string elementName)
 
const TiXmlDocument & getDocument ()
 
- Protected Member Functions inherited from tinyxml_tools::DocumentHandle
bool writeable ()
 Check whether document can be saved (overwritten) More...
 
bool readable ()
 Check whether document shall be read on creation. More...
 

Protected Attributes

TiXmlDocument document_
 
TiXmlHandle rootHandle_
 
TiXmlHandle seekedHandle_
 
- Protected Attributes inherited from tinyxml_tools::DocumentHandle
std::string filepath_
 Path of the handled file. More...
 
DocumentMode mode_
 Document mode ( allows protecting files against reads/writes ) More...
 

Constructor & Destructor Documentation

tinyxml_tools::DocumentHandleXML::DocumentHandleXML ( )

Default ctor.

tinyxml_tools::DocumentHandleXML::~DocumentHandleXML ( )
overridedefault

Default dtor.

Member Function Documentation

std::string tinyxml_tools::DocumentHandleXML::convertPath ( const std::string &  path)
protected
bool tinyxml_tools::DocumentHandleXML::create ( const std::string &  path,
DocumentMode  mode 
)
inlineoverridevirtual

Opens or creates a file at 'path' in depending on 'mode'.

Parameters
pathPath of the config file to open/store
modeAccess mode for the document
Returns
true, iff successful

Implements tinyxml_tools::DocumentHandle.

bool tinyxml_tools::DocumentHandleXML::create ( const std::string &  path,
DocumentMode  mode,
const std::string &  rootName 
)
void tinyxml_tools::DocumentHandleXML::findElements ( std::vector< TiXmlHandle > &  handles,
TiXmlHandle  tree,
std::string  elementName 
)
protected
const TiXmlDocument& tinyxml_tools::DocumentHandleXML::getDocument ( )
inlineprotected
TiXmlHandle tinyxml_tools::DocumentHandleXML::getDocumentHandle ( )
inline
TiXmlHandle tinyxml_tools::DocumentHandleXML::getRootHandle ( )
inline
bool tinyxml_tools::DocumentHandleXML::merge ( const std::string &  path,
MergeMode  mode 
)
overridevirtual

Merges file at 'path' with the handled document.

Parameters
pathPath of the config file to append
modeMode of the merge, see Enum description on top of this file
Returns
true, iff successful

Implements tinyxml_tools::DocumentHandle.

bool tinyxml_tools::DocumentHandleXML::merge ( const std::string &  path,
MergeMode  mode,
bool  force 
)
protected
bool tinyxml_tools::DocumentHandleXML::mergeTrees ( TiXmlHandle  tree1,
TiXmlHandle  tree2,
MergeMode  mode 
)
protected
template<typename T , typename U = T, typename = typename std::enable_if<!std::is_const<T>::value && std::is_convertible<U, T>::value>::type>
bool tinyxml_tools::DocumentHandleXML::read ( const std::string &  name,
T &  value,
const typename traits::element< T >::stringType &  attributeName = traits::element<T>::getDefaultName(),
const U &  defaultValue = traits::element<T>::getDefaultValue() 
) const
inline
template<typename T , typename U = T, typename = typename std::enable_if<!std::is_const<T>::value && std::is_convertible<U, T>::value>::type>
bool tinyxml_tools::DocumentHandleXML::readAttributes ( T &  value,
const typename traits::element< T >::stringType &  attributeName = traits::element<T>::getDefaultName(),
const U &  defaultValue = traits::element<T>::getDefaultValue() 
) const
inline
template<typename T , typename = typename std::enable_if<!std::is_const<T>::value>>
bool tinyxml_tools::DocumentHandleXML::readSiblingAttributes ( T &  value,
const typename traits::element< T >::siblingStringType &  attributeName = traits::element<typename traits::element<T>::siblingType>::getDefaultName(),
const typename traits::element< T >::siblingType &  defaultValue = traits::element<typename traits::element<T>::siblingType>::getDefaultValue() 
) const
inline
template<typename T , typename = typename std::enable_if<!std::is_const<T>::value>>
bool tinyxml_tools::DocumentHandleXML::readSiblings ( const std::string &  name,
T &  value,
const typename traits::element< T >::siblingStringType &  attributeName = traits::element<typename traits::element<T>::siblingType>::getDefaultName(),
const typename traits::element< T >::siblingType &  defaultValue = traits::element<typename traits::element<T>::siblingType>::getDefaultValue() 
) const
inline
void tinyxml_tools::DocumentHandleXML::reset ( )
bool tinyxml_tools::DocumentHandleXML::resolveDefault ( )
protected
bool tinyxml_tools::DocumentHandleXML::resolveExtensions ( )
protected
bool tinyxml_tools::DocumentHandleXML::resolveIncludes ( )
protected
bool tinyxml_tools::DocumentHandleXML::saveAs ( const std::string &  path,
bool  force 
)
overridevirtual

Saves the current configuration to 'path'.

Parameters
pathpath of the output file
forceforce saving if file already exists
Returns
true, iff successful

Implements tinyxml_tools::DocumentHandle.

bool tinyxml_tools::DocumentHandleXML::seek ( std::string  handle)
bool tinyxml_tools::DocumentHandleXML::seekFromRoot ( const std::string &  handle)
template<typename T >
bool tinyxml_tools::DocumentHandleXML::write ( const std::string &  name,
const T &  value,
const typename traits::element< T >::stringType &  attributeName = traits::element<T>::getDefaultName() 
)
inline
template<typename T >
bool tinyxml_tools::DocumentHandleXML::writeAttributes ( const T &  value,
const typename traits::element< T >::stringType &  attributeName = traits::element<T>::getDefaultName() 
)
inline
template<typename T >
bool tinyxml_tools::DocumentHandleXML::writeSiblings ( const std::string &  name,
const T &  value,
const typename traits::element< T >::siblingStringType &  attributeName = traits::element<typename traits::element<T>::siblingType>::getDefaultName() 
)
inline

Member Data Documentation

TiXmlDocument tinyxml_tools::DocumentHandleXML::document_
protected
TiXmlHandle tinyxml_tools::DocumentHandleXML::rootHandle_
protected
TiXmlHandle tinyxml_tools::DocumentHandleXML::seekedHandle_
protected

The documentation for this class was generated from the following file: