summaryrefslogtreecommitdiff
path: root/src/core/parser/ParserStack.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/parser/ParserStack.hpp')
-rw-r--r--src/core/parser/ParserStack.hpp17
1 files changed, 15 insertions, 2 deletions
diff --git a/src/core/parser/ParserStack.hpp b/src/core/parser/ParserStack.hpp
index 4af88f9..6296dff 100644
--- a/src/core/parser/ParserStack.hpp
+++ b/src/core/parser/ParserStack.hpp
@@ -322,6 +322,11 @@ private:
std::stack<HandlerInstance> stack;
/**
+ * Reference at some user defined data.
+ */
+ void *userData;
+
+ /**
* Used internally to get all expected command names for the given state
* (does not work if the current Handler instance allows arbitrary
* children). This function is used to build error messages.
@@ -340,8 +345,9 @@ public:
* corresponding HandlerDescriptor instances.
*/
ParserStack(ParserContext &ctx,
- const std::multimap<std::string, HandlerDescriptor> &handlers)
- : ctx(ctx), handlers(handlers){};
+ const std::multimap<std::string, HandlerDescriptor> &handlers,
+ void *userData = nullptr)
+ : ctx(ctx), handlers(handlers), userData(userData){};
/**
* Returns the state the ParserStack instance currently is in.
@@ -419,6 +425,13 @@ public:
* @return a reference to the parser context.
*/
ParserContext &getContext() { return ctx; }
+
+ /**
+ * Returns the user defined data.
+ *
+ * @return the userData pointer that was given in the constructor.
+ */
+ void *getUserData() { return userData; }
};
}