From 84f0004cdf45f6fbad6461676897aa27f03cbb93 Mon Sep 17 00:00:00 2001 From: Andreas Stöckel Date: Tue, 27 Jan 2015 01:39:19 +0100 Subject: Removed dependency between "Project" model class and parser/resources. This reduces coupling and was stupid beforehand. --- src/core/parser/ParserContext.cpp | 39 +++++++++++++++++++++++++++++++-------- 1 file changed, 31 insertions(+), 8 deletions(-) (limited to 'src/core/parser/ParserContext.cpp') diff --git a/src/core/parser/ParserContext.cpp b/src/core/parser/ParserContext.cpp index 0a75fdf..b0d04d4 100644 --- a/src/core/parser/ParserContext.cpp +++ b/src/core/parser/ParserContext.cpp @@ -16,32 +16,55 @@ along with this program. If not, see . */ +#include +#include + +#include "ParserScope.hpp" #include "ParserContext.hpp" namespace ousia { /* Class ParserContext */ -ParserContext::ParserContext(Handle project, ParserScope &scope, - SourceId sourceId, Logger &logger) - : project(project), scope(scope), sourceId(sourceId), logger(logger) +ParserContext::ParserContext(Registry ®istry, + ResourceManager &resourceManager, + ParserScope &scope, Handle project, + Logger &logger, SourceId sourceId) + : registry(registry), + resourceManager(resourceManager), + scope(scope), + project(project), + logger(logger), + sourceId(sourceId) +{ +} + +Rooted ParserContext::link(const std::string &path, + const std::string mimetype, + const std::string rel, + const RttiSet &supportedTypes) { + return resourceManager.link(*this, path, mimetype, rel, supportedTypes); } -ParserContext::ParserContext(Handle project, ParserScope &scope, - Logger &logger) - : project(project), scope(scope), sourceId(InvalidSourceId), logger(logger) +Rooted ParserContext::include(const std::string &path, + const std::string mimetype, + const std::string rel, + const RttiSet &supportedTypes) { + return resourceManager.include(*this, path, mimetype, rel, supportedTypes); } ParserContext ParserContext::clone(ParserScope &scope, SourceId sourceId) const { - return ParserContext{project, scope, sourceId, logger}; + return ParserContext{registry, resourceManager, scope, + project, logger, sourceId}; } ParserContext ParserContext::clone(SourceId sourceId) const { - return ParserContext{project, scope, sourceId, logger}; + return ParserContext{registry, resourceManager, scope, + project, logger, sourceId}; } Manager &ParserContext::getManager() const { return project->getManager(); } -- cgit v1.2.3