MIRA
Public Types | Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | Friends | List of all members
XMLDomPreprocessor Class Reference

Preprocesses XML documents and resolves all special tags like , <if>, <warning> and so on. More...

#include <xml/XMLDomPreprocessor.h>

Public Types

typedef boost::function< std::string(const std::string &)> Callback
 
typedef std::list< PathIncludePathStack
 

Public Member Functions

 XMLDomPreprocessor (bool expandOnly=false)
 
 XMLDomPreprocessor (const XMLVariablesMap &iVariables, bool expandOnly=false)
 
void preprocessXML (XMLDom &ioXml)
 
void registerXMLVariableCallback (const std::string &pattern, Callback &&callback)
 
XMLMacroProcessorgetMacroProcessor ()
 
bool expandMacrosOnly () const
 
 ~XMLDomPreprocessor ()
 

Public Attributes

XMLVariablesMap variables
 

Protected Member Functions

std::string resolveXMLVariables (const std::string &pattern, const std::string &var)
 
std::string resolveContent (std::string content)
 
void preprocessAllLowLevel (XMLDom::iterator &iNode)
 
void processSpecialVariables (XMLDom::iterator &node)
 
bool parseCondition (XMLDom::iterator &node)
 
bool parseConditionsRequireAll (XMLDom::iterator &node)
 
bool parseConditionsRequireAny (XMLDom::iterator &node)
 
bool parseExists (XMLDom::iterator &node)
 
bool parseExistsRequireAll (XMLDom::iterator &node)
 
bool parseExistsRequireAny (XMLDom::iterator &node)
 
XMLDom::iterator parseInclude (XMLDom::iterator &ioNode)
 
void preprocessAll (XMLDom::iterator &iNode)
 

Protected Attributes

std::map< std::string, CallbackmCallbacks
 
bool mAddedInfoToException
 
std::unique_ptr< XMLMacroProcessormMacroProcessor
 
IncludePathStack mIncludePathStack
 
bool mExpandMacrosOnly
 

Friends

class XMLMacroProcessor
 

Detailed Description

Preprocesses XML documents and resolves all special tags like , <if>, <warning> and so on.

It also parses variable declarations via the tag. See help about XML config files. The member variables contains a key value variables map that will be altered if an <define> or tag is found and the variable name is not already in the map. It also processes special xml variables like find, findpkg or env. Additionally the user can add callbacks for user defined patterns that are called whenever the pattern is found anywhere in the document.

Member Typedef Documentation

◆ Callback

typedef boost::function<std::string (const std::string&)> Callback

◆ IncludePathStack

typedef std::list<Path> IncludePathStack

Constructor & Destructor Documentation

◆ XMLDomPreprocessor() [1/2]

XMLDomPreprocessor ( bool  expandOnly = false)

◆ XMLDomPreprocessor() [2/2]

XMLDomPreprocessor ( const XMLVariablesMap iVariables,
bool  expandOnly = false 
)

◆ ~XMLDomPreprocessor()

Member Function Documentation

◆ preprocessXML()

void preprocessXML ( XMLDom ioXml)

◆ registerXMLVariableCallback()

void registerXMLVariableCallback ( const std::string &  pattern,
Callback &&  callback 
)

◆ getMacroProcessor()

XMLMacroProcessor& getMacroProcessor ( )
inline

◆ expandMacrosOnly()

bool expandMacrosOnly ( ) const
inline

◆ resolveXMLVariables()

std::string resolveXMLVariables ( const std::string &  pattern,
const std::string &  var 
)
protected

◆ resolveContent()

std::string resolveContent ( std::string  content)
protected

◆ preprocessAllLowLevel()

void preprocessAllLowLevel ( XMLDom::iterator iNode)
protected

◆ processSpecialVariables()

void processSpecialVariables ( XMLDom::iterator node)
protected

◆ parseCondition()

bool parseCondition ( XMLDom::iterator node)
protected

◆ parseConditionsRequireAll()

bool parseConditionsRequireAll ( XMLDom::iterator node)
protected

◆ parseConditionsRequireAny()

bool parseConditionsRequireAny ( XMLDom::iterator node)
protected

◆ parseExists()

bool parseExists ( XMLDom::iterator node)
protected

◆ parseExistsRequireAll()

bool parseExistsRequireAll ( XMLDom::iterator node)
protected

◆ parseExistsRequireAny()

bool parseExistsRequireAny ( XMLDom::iterator node)
protected

◆ parseInclude()

XMLDom::iterator parseInclude ( XMLDom::iterator ioNode)
protected

◆ preprocessAll()

void preprocessAll ( XMLDom::iterator iNode)
protected

Friends And Related Function Documentation

◆ XMLMacroProcessor

friend class XMLMacroProcessor
friend

Member Data Documentation

◆ variables

XMLVariablesMap variables

◆ mCallbacks

std::map<std::string, Callback> mCallbacks
protected

◆ mAddedInfoToException

bool mAddedInfoToException
protected

◆ mMacroProcessor

std::unique_ptr<XMLMacroProcessor> mMacroProcessor
protected

◆ mIncludePathStack

IncludePathStack mIncludePathStack
protected

◆ mExpandMacrosOnly

bool mExpandMacrosOnly
protected

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