From 2eec59a47ec36e5e4f921ca91284942b4d7d521b Mon Sep 17 00:00:00 2001 From: Andreas Stöckel Date: Sun, 18 Jan 2015 21:42:49 +0100 Subject: Fixed bugs in definition of Project, added reference to Project to ParserContext --- src/core/model/Project.cpp | 11 +++++++++++ src/core/model/Project.hpp | 15 +++++++++------ src/core/parser/Parser.hpp | 17 ++++++++++++++--- src/core/parser/ParserStack.hpp | 2 ++ 4 files changed, 36 insertions(+), 9 deletions(-) (limited to 'src/core') diff --git a/src/core/model/Project.cpp b/src/core/model/Project.cpp index 6b6eef6..c491d4f 100644 --- a/src/core/model/Project.cpp +++ b/src/core/model/Project.cpp @@ -43,6 +43,11 @@ bool Project::doValidate(Logger &logger) const continueValidation(typesystems, logger); } +Rooted Project::getSystemTypesystem() +{ + return systemTypesystem; +} + Rooted Project::createTypesystem(const std::string &name) { Rooted typesystem{ @@ -82,6 +87,12 @@ void Project::addDomain(Handle domain) invalidate(); domains.push_back(domain); } + +const NodeVector &Project::getDocuments() { return documents; } + +const NodeVector &Project::getDomains() { return domains; } + +const NodeVector &Project::getTypesystems() { return typesystems; } } namespace RttiTypes { diff --git a/src/core/model/Project.hpp b/src/core/model/Project.hpp index 7f0672a..576bd60 100644 --- a/src/core/model/Project.hpp +++ b/src/core/model/Project.hpp @@ -35,11 +35,14 @@ namespace ousia { // Forward declarations class Logger; class Rtti; -class SystemTypesystem; -class Typesystem; namespace model { +class SystemTypesystem; +class Typesystem; +class Document; +class Domain; + /** * The Project class constitutes the top-level node in which documents, domains, * typesystems and other resources are embedded. @@ -88,7 +91,7 @@ public: * * @return a reference to the system typesystem. */ - Rooted getSystemTypesystem() { return systemTypesystem; } + Rooted getSystemTypesystem(); /** * Returns a new typesystem with the given name adds it to the list of @@ -141,21 +144,21 @@ public: * * @return a reference pointing at the document list. */ - const NodeVector &getDocuments() { return documents; } + const NodeVector &getDocuments(); /** * Returns all domains of this project. * * @return a reference pointing at the domain list. */ - const NodeVector &getDomains() { return domains; } + const NodeVector &getDomains(); /** * Returns all typesystems of this project. * * @return a reference pointing at the typesystem list. */ - const NodeVector &getTypesystems() { return typesystems; } + const NodeVector &getTypesystems(); }; } diff --git a/src/core/parser/Parser.hpp b/src/core/parser/Parser.hpp index 63c57c3..049ee4e 100644 --- a/src/core/parser/Parser.hpp +++ b/src/core/parser/Parser.hpp @@ -37,6 +37,7 @@ #include #include #include +#include #include "Scope.hpp" @@ -69,6 +70,11 @@ struct ParserContext { */ Manager &manager; + /** + * Project instance into which the new content should be parsed. + */ + Rooted project; + /** * Constructor of the ParserContext class. * @@ -80,11 +86,16 @@ struct ParserContext { * @param logger is a reference to the Logger instance that should be used * to log error messages and warnings that occur while parsing the document. * @param manager is a Reference to the Manager the parser should append - *nodes to. + * nodes to. + * @param project is the project into which the content should be parsed. */ ParserContext(Scope &scope, Registry ®istry, Logger &logger, - Manager &manager) - : scope(scope), registry(registry), logger(logger), manager(manager){}; + Manager &manager, Handle project) + : scope(scope), + registry(registry), + logger(logger), + manager(manager), + project(project){}; }; /** diff --git a/src/core/parser/ParserStack.hpp b/src/core/parser/ParserStack.hpp index aa196e7..492ab9c 100644 --- a/src/core/parser/ParserStack.hpp +++ b/src/core/parser/ParserStack.hpp @@ -147,6 +147,8 @@ public: Logger &logger() { return handlerData.ctx.logger; } + Rooted project() { return handlerData.ctx.project; } + State state() { return handlerData.state; } State parentState() { return handlerData.parentState; } -- cgit v1.2.3