summaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
Diffstat (limited to 'src/core')
-rw-r--r--src/core/model/Project.cpp15
-rw-r--r--src/core/model/Project.hpp15
2 files changed, 23 insertions, 7 deletions
diff --git a/src/core/model/Project.cpp b/src/core/model/Project.cpp
index 1452de2..2833b37 100644
--- a/src/core/model/Project.cpp
+++ b/src/core/model/Project.cpp
@@ -36,8 +36,8 @@ Project::Project(Manager &mgr, Registry &registry)
}
Rooted<Node> Project::parse(const std::string &path, const std::string mimetype,
- const std::string rel, RttiSet &supportedTypes,
- Logger &logger)
+ const std::string rel,
+ const RttiSet &supportedTypes, Logger &logger)
{
ParserScope scope;
ParserContext context(this, scope, logger);
@@ -47,7 +47,7 @@ Rooted<Node> Project::parse(const std::string &path, const std::string mimetype,
Rooted<Node> Project::link(ParserContext &ctx, const std::string &path,
const std::string mimetype, const std::string rel,
- RttiSet &supportedTypes)
+ const RttiSet &supportedTypes)
{
return resourceManager.link(registry, ctx, path, mimetype, rel,
supportedTypes);
@@ -55,12 +55,19 @@ Rooted<Node> Project::link(ParserContext &ctx, const std::string &path,
Rooted<Node> Project::include(ParserContext &ctx, const std::string &path,
const std::string mimetype, const std::string rel,
- RttiSet &supportedTypes)
+ const RttiSet &supportedTypes)
{
return resourceManager.include(registry, ctx, path, mimetype, rel,
supportedTypes);
}
+SourceContextCallback Project::getSourceContextCallback()
+{
+ return [&](const SourceLocation &location) {
+ return resourceManager.readContext(location);
+ };
+}
+
bool Project::doValidate(Logger &logger) const
{
return continueValidation(documents, logger);
diff --git a/src/core/model/Project.hpp b/src/core/model/Project.hpp
index 4743454..1c33dc8 100644
--- a/src/core/model/Project.hpp
+++ b/src/core/model/Project.hpp
@@ -111,7 +111,7 @@ public:
* @return the parsed node or nullptr if something goes wrong.
*/
Rooted<Node> parse(const std::string &path, const std::string mimetype,
- const std::string rel, RttiSet &supportedTypes,
+ const std::string rel, const RttiSet &supportedTypes,
Logger &logger);
/**
@@ -136,7 +136,7 @@ public:
*/
Rooted<Node> link(ParserContext &ctx, const std::string &path,
const std::string mimetype, const std::string rel,
- RttiSet &supportedTypes);
+ const RttiSet &supportedTypes);
/**
* Parses a file with ParserContext and the current ParserScope. In contrast
@@ -160,7 +160,16 @@ public:
*/
Rooted<Node> include(ParserContext &ctx, const std::string &path,
const std::string mimetype, const std::string rel,
- RttiSet &supportedTypes);
+ const RttiSet &supportedTypes);
+
+ /**
+ * Returns a SourceContextCallback that can be passed to a logger instance.
+ * Remeber to reset the SourceContextCallback after the Project instance has
+ * been freed.
+ *
+ * @return a SourceContextCallback that is coupled to this Project instance.
+ */
+ SourceContextCallback getSourceContextCallback();
/**
* Returns a reference to the internal system typesystem.