From c4b221e8b318fa612e8afcca59011f7b5e41b4bc Mon Sep 17 00:00:00 2001 From: Andreas Stöckel Date: Mon, 2 Feb 2015 02:00:36 +0100 Subject: Added function giving Handlers access to the ParserContext (for import, include) --- src/core/parser/ParserStack.hpp | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'src/core/parser/ParserStack.hpp') diff --git a/src/core/parser/ParserStack.hpp b/src/core/parser/ParserStack.hpp index 9bb080e..7ad3da1 100644 --- a/src/core/parser/ParserStack.hpp +++ b/src/core/parser/ParserStack.hpp @@ -55,7 +55,7 @@ struct HandlerData { * Reference to the ParserContext instance that should be used to resolve * references to nodes in the Graph. */ - const ParserContext &ctx; + ParserContext &ctx; /** * Contains the name of the tag that is being handled. @@ -86,8 +86,9 @@ struct HandlerData { * @param parentState is the state of the parent command. * @param location is the location at which the handler is created. */ - HandlerData(const ParserContext &ctx, std::string name, const ParserState &state, - const ParserState &parentState, const SourceLocation location) + HandlerData(ParserContext &ctx, std::string name, + const ParserState &state, const ParserState &parentState, + const SourceLocation location) : ctx(ctx), name(std::move(name)), state(state), @@ -121,6 +122,13 @@ public: */ virtual ~Handler(){}; + /** + * Returns a reference at the ParserContext. + * + * @return a reference at the ParserContext. + */ + ParserContext &context() { return handlerData.ctx; } + /** * Returns the command name for which the handler was created. * @@ -260,7 +268,7 @@ public: * corresponding ParserState instances. */ ParserStack(ParserContext &ctx, - const std::multimap &states); + const std::multimap &states); /** * Returns the state the ParserStack instance currently is in. -- cgit v1.2.3