MIRA
Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Attributes | Static Protected Attributes | List of all members
XMLMacroProcessor Class Reference

#include <xml/macros/XMLMacroProcessor.h>

Public Member Functions

 XMLMacroProcessor (XMLDomPreprocessor &)
 
XMLDomPreprocessorgetPreprocessor ()
 
XMLNode expand (XMLNode ioNode)
 Expand a macro. More...
 
bool isMacro (const XMLDom::const_iterator &node)
 
void onDocumentEntered (XMLDom::const_iterator root, XMLDom::iterator ioDocument)
 To be called before the contents of a document are processed. More...
 
void onDocumentLeft (const std::string &targetNamespace="")
 To be called after an included document has been processed. More...
 
XMLNode processInPlace (XMLNode ioNode)
 
XMLNode invokeMacro (const std::string &name, XMLNode node)
 
xmlmacros::ScopePtr swapScope (xmlmacros::ScopePtr scope)
 
xmlmacros::ScopegetCurrentScope ()
 
const xmlmacros::ScopegetCurrentScope () const
 
xmlmacros::ScopePtr getCurrentScopePtr () const
 
xmlmacros::ScopePtr getGlobalScopePtr () const
 
std::string coerceToString (const std::string &name)
 
void pushInvocation (xmlmacros::SourceInfo &&)
 
void popInvocation ()
 

Static Public Member Functions

static std::tuple< xmlmacros::Identifier, std::string > getIdentifier (XMLDom::const_iterator node)
 
static xmlmacros::Identifier makeIdentifier (const std::string &name)
 

Static Public Attributes

static const XMLDom::NameSpace NAMESPACE
 

Protected Attributes

xmlmacros::ScopePtr mGlobalScope
 Global scope of the macro processor. More...
 
xmlmacros::ScopePtr mCurrentScope
 Current active definition scope. More...
 
std::stack< xmlmacros::ScopePtrmImportStack
 Scopes of higher-up documents. More...
 
std::vector< xmlmacros::SourceInfomInvokeStack
 Keeps track of the invoke-path of macros for error messages. More...
 
XMLDomPreprocessormPreprocessor
 
xmlmacros::MacroPtr mDefineHandler
 
xmlmacros::MacroPtr mInlineImportHandler
 

Static Protected Attributes

static const uint MAX_INVOKE_DEPTH = 1000
 Used to prevent infinite recursion. More...
 

Constructor & Destructor Documentation

◆ XMLMacroProcessor()

Member Function Documentation

◆ getPreprocessor()

XMLDomPreprocessor& getPreprocessor ( )
inline

◆ expand()

XMLNode expand ( XMLNode  ioNode)

Expand a macro.

Parameters
ioNodeNode to expand in-place.
Returns
an iterator to the next node to process.

◆ isMacro()

bool isMacro ( const XMLDom::const_iterator node)

◆ onDocumentEntered()

void onDocumentEntered ( XMLDom::const_iterator  root,
XMLDom::iterator  ioDocument 
)

To be called before the contents of a document are processed.

Parameters
rootThe original root node of the included file.
ioDocumentThe root node to modify.

◆ onDocumentLeft()

void onDocumentLeft ( const std::string &  targetNamespace = "")

To be called after an included document has been processed.

Parameters
targetNamespaceMake macros from the included document available under the specified namespace. Empty to not import macros.

◆ processInPlace()

XMLNode processInPlace ( XMLNode  ioNode)

◆ invokeMacro()

XMLNode invokeMacro ( const std::string &  name,
XMLNode  node 
)

◆ swapScope()

xmlmacros::ScopePtr swapScope ( xmlmacros::ScopePtr  scope)
inline

◆ getCurrentScope() [1/2]

xmlmacros::Scope& getCurrentScope ( )
inline

◆ getCurrentScope() [2/2]

const xmlmacros::Scope& getCurrentScope ( ) const
inline

◆ getCurrentScopePtr()

xmlmacros::ScopePtr getCurrentScopePtr ( ) const
inline

◆ getGlobalScopePtr()

xmlmacros::ScopePtr getGlobalScopePtr ( ) const
inline

◆ coerceToString()

std::string coerceToString ( const std::string &  name)
Returns
the content of the given macro as string.

◆ pushInvocation()

void pushInvocation ( xmlmacros::SourceInfo &&  )

◆ popInvocation()

void popInvocation ( )

◆ getIdentifier()

static std::tuple<xmlmacros::Identifier, std::string> getIdentifier ( XMLDom::const_iterator  node)
inlinestatic

◆ makeIdentifier()

static xmlmacros::Identifier makeIdentifier ( const std::string &  name)
inlinestatic

Member Data Documentation

◆ NAMESPACE

const XMLDom::NameSpace NAMESPACE
static

◆ mGlobalScope

xmlmacros::ScopePtr mGlobalScope
protected

Global scope of the macro processor.

◆ mCurrentScope

xmlmacros::ScopePtr mCurrentScope
protected

Current active definition scope.

◆ mImportStack

std::stack<xmlmacros::ScopePtr> mImportStack
protected

Scopes of higher-up documents.

◆ MAX_INVOKE_DEPTH

const uint MAX_INVOKE_DEPTH = 1000
staticprotected

Used to prevent infinite recursion.

◆ mInvokeStack

std::vector<xmlmacros::SourceInfo> mInvokeStack
protected

Keeps track of the invoke-path of macros for error messages.

◆ mPreprocessor

XMLDomPreprocessor* mPreprocessor
protected

◆ mDefineHandler

xmlmacros::MacroPtr mDefineHandler
protected

◆ mInlineImportHandler

xmlmacros::MacroPtr mInlineImportHandler
protected

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