47 #ifndef _MIRA_XML_MACROS_XML_MACRO_PROCESSOR_H_ 48 #define _MIRA_XML_MACROS_XML_MACRO_PROCESSOR_H_ 52 #include <unordered_map> 60 class XMLDomPreprocessor;
152 std::string nodeName = *node;
153 auto dotPos = nodeName.
find(
'.');
155 std::string name = dotPos == std::string::npos ?
156 std::move(nodeName) :
157 nodeName.substr(0, dotPos);
159 std::string selector = dotPos == std::string::npos ?
161 nodeName.substr(dotPos + 1);
207 #endif // _MIRA_XML_MACROS_XML_MACRO_PROCESSOR_H_ void pushInvocation(xmlmacros::SourceInfo &&)
XMLDomPreprocessor * mPreprocessor
Definition: XMLMacroProcessor.h:196
void onDocumentEntered(XMLDom::const_iterator root, XMLDom::iterator ioDocument)
To be called before the contents of a document are processed.
void onDocumentLeft(const std::string &targetNamespace="")
To be called after an included document has been processed.
specialize cv::DataType for our ImgPixel and inherit from cv::DataType<Vec>
Definition: IOService.h:67
XMLNode expand(XMLNode ioNode)
Expand a macro.
static const uint MAX_INVOKE_DEPTH
Used to prevent infinite recursion.
Definition: XMLMacroProcessor.h:190
xmlmacros::MacroPtr mDefineHandler
Definition: XMLMacroProcessor.h:199
xmlmacros::ScopePtr mCurrentScope
Current active definition scope.
Definition: XMLMacroProcessor.h:183
std::vector< xmlmacros::SourceInfo > mInvokeStack
Keeps track of the invoke-path of macros for error messages.
Definition: XMLMacroProcessor.h:193
const xmlmacros::Scope & getCurrentScope() const
Definition: XMLMacroProcessor.h:124
NameSpace nameSpace() const
Return the namespace information of the node.
xmlmacros::MacroPtr mInlineImportHandler
Definition: XMLMacroProcessor.h:201
std::string coerceToString(const std::string &name)
xmlmacros::ScopePtr getGlobalScopePtr() const
Definition: XMLMacroProcessor.h:135
static const XMLDom::NameSpace NAMESPACE
Definition: XMLMacroProcessor.h:66
Const sibling_iterator for iterating over xml nodes that have the same parent (siblings) ...
Definition: XMLDom.h:763
XMLNode invokeMacro(const std::string &name, XMLNode node)
bool isMacro(const XMLDom::const_iterator &node)
Namespace information of a node.
Definition: XMLDom.h:90
static xmlmacros::Identifier makeIdentifier(const std::string &name)
Definition: XMLMacroProcessor.h:169
Variable scope of the macro processor.
Definition: Scope.h:76
static std::tuple< xmlmacros::Identifier, std::string > getIdentifier(XMLDom::const_iterator node)
Definition: XMLMacroProcessor.h:150
std::stack< xmlmacros::ScopePtr > mImportStack
Scopes of higher-up documents.
Definition: XMLMacroProcessor.h:186
Data structure for storing macro definitions.
xmlmacros::ScopePtr mGlobalScope
Global scope of the macro processor.
Definition: XMLMacroProcessor.h:178
XMLNode processInPlace(XMLNode ioNode)
Iterator for iterating over xml nodes that have the same parent (sibligs)
Definition: XMLDom.h:850
xmlmacros::Scope & getCurrentScope()
Definition: XMLMacroProcessor.h:118
xmlmacros::ScopePtr swapScope(xmlmacros::ScopePtr scope)
Definition: XMLMacroProcessor.h:112
xmlmacros::ScopePtr getCurrentScopePtr() const
Definition: XMLMacroProcessor.h:130
Preprocesses XML documents and resolves all special tags like , <if>, <warning> and so on...
Definition: XMLDomPreprocessor.h:109
Definition: XMLMacroProcessor.h:62
XMLMacroProcessor(XMLDomPreprocessor &)
std::string prefix
Definition: XMLDom.h:97
Scope::Ptr ScopePtr
Definition: Scope.h:155
Interface for implementing XML macros.
std::shared_ptr< IMacro > MacroPtr
Definition: IMacro.h:99
XMLDomPreprocessor & getPreprocessor()
Definition: XMLMacroProcessor.h:75
const_sibling_iterator find(const std::string &name, std::size_t nth=0) const
Find the nth subnode with a given name.