summaryrefslogtreecommitdiff
path: root/src/core/parser/ParserContext.cpp
diff options
context:
space:
mode:
authorAndreas Stöckel <astoecke@techfak.uni-bielefeld.de>2015-01-27 01:39:19 +0100
committerAndreas Stöckel <astoecke@techfak.uni-bielefeld.de>2015-01-27 01:39:19 +0100
commit84f0004cdf45f6fbad6461676897aa27f03cbb93 (patch)
treeacb15536b40d7389c3c65df1567084bb57da416e /src/core/parser/ParserContext.cpp
parent495e2de57e587450e9532c7fe4ae0c2bfb196e6c (diff)
Removed dependency between "Project" model class and parser/resources. This reduces coupling and was stupid beforehand.
Diffstat (limited to 'src/core/parser/ParserContext.cpp')
-rw-r--r--src/core/parser/ParserContext.cpp39
1 files changed, 31 insertions, 8 deletions
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 <http://www.gnu.org/licenses/>.
*/
+#include <core/resource/ResourceManager.hpp>
+#include <core/Registry.hpp>
+
+#include "ParserScope.hpp"
#include "ParserContext.hpp"
namespace ousia {
/* Class ParserContext */
-ParserContext::ParserContext(Handle<Project> project, ParserScope &scope,
- SourceId sourceId, Logger &logger)
- : project(project), scope(scope), sourceId(sourceId), logger(logger)
+ParserContext::ParserContext(Registry &registry,
+ ResourceManager &resourceManager,
+ ParserScope &scope, Handle<Project> project,
+ Logger &logger, SourceId sourceId)
+ : registry(registry),
+ resourceManager(resourceManager),
+ scope(scope),
+ project(project),
+ logger(logger),
+ sourceId(sourceId)
+{
+}
+
+Rooted<Node> 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> project, ParserScope &scope,
- Logger &logger)
- : project(project), scope(scope), sourceId(InvalidSourceId), logger(logger)
+Rooted<Node> 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(); }