From 6decad0b8e7e369bd8215f31a45dd3eae982d2a9 Mon Sep 17 00:00:00 2001 From: Andreas Stöckel Date: Wed, 21 Jan 2015 01:17:49 +0100 Subject: Some further refactoring -- renamed Scope to ParserScope, got rid of parser namespace, added new functionality to RegistryClass, wrote documentation, added function for extracting file extensions to Utils --- src/core/parser/ParserStack.hpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'src/core/parser/ParserStack.hpp') diff --git a/src/core/parser/ParserStack.hpp b/src/core/parser/ParserStack.hpp index 492ab9c..4af88f9 100644 --- a/src/core/parser/ParserStack.hpp +++ b/src/core/parser/ParserStack.hpp @@ -42,9 +42,9 @@ #include #include "Parser.hpp" +#include "ParserContext.hpp" namespace ousia { -namespace parser { /** * The State type alias is used to @@ -139,7 +139,7 @@ public: const std::string &name() { return handlerData.name; } - Scope &scope() { return handlerData.ctx.scope; } + ParserScope &scope() { return handlerData.ctx.scope; } Registry ®istry() { return handlerData.ctx.registry; } @@ -421,7 +421,6 @@ public: ParserContext &getContext() { return ctx; } }; } -} #endif /* _OUSIA_PARSER_STACK_HPP_ */ -- cgit v1.2.3 From a5e14d8304716289f7ede9834d063bb212f76e83 Mon Sep 17 00:00:00 2001 From: Andreas Stöckel Date: Fri, 23 Jan 2015 15:31:06 +0100 Subject: Ability to add user data to ParserStack (this is just a hack, there should be a better solution, e.g. to derive from ParserStack) --- src/core/parser/ParserStack.hpp | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'src/core/parser/ParserStack.hpp') 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 @@ -321,6 +321,11 @@ private: */ std::stack 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 @@ -340,8 +345,9 @@ public: * corresponding HandlerDescriptor instances. */ ParserStack(ParserContext &ctx, - const std::multimap &handlers) - : ctx(ctx), handlers(handlers){}; + const std::multimap &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; } }; } -- cgit v1.2.3