summaryrefslogtreecommitdiff
path: root/src/core/Registry.cpp
diff options
context:
space:
mode:
authorAndreas Stöckel <astoecke@techfak.uni-bielefeld.de>2015-02-16 20:47:07 +0100
committerAndreas Stöckel <astoecke@techfak.uni-bielefeld.de>2015-02-16 20:47:07 +0100
commit4a4e2245730ead7fce354469fe626398520f12b2 (patch)
treeaf42dbf2fd9ea87884cd500367c4017293609863 /src/core/Registry.cpp
parent6de2c8ad9450a8b349161d37ad7cab538324034d (diff)
parent75eea3bdd846a34c69be3d09f41ff4fae706628e (diff)
using remote version of simple_book.osml
Diffstat (limited to 'src/core/Registry.cpp')
-rw-r--r--src/core/Registry.cpp25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/core/Registry.cpp b/src/core/Registry.cpp
index 2bb6a98..e950cdc 100644
--- a/src/core/Registry.cpp
+++ b/src/core/Registry.cpp
@@ -131,5 +131,30 @@ bool Registry::locateResource(Resource &resource, const std::string &path,
return false;
}
+
+std::vector<std::string> Registry::autocompleteResource(
+ const std::string &path, ResourceType type,
+ const Resource &relativeTo) const
+{
+ std::vector<std::string> res;
+
+ // Try the locator of the given "relativeTo" resource first
+ if (relativeTo.isValid()) {
+ res = relativeTo.getLocator().autocomplete(path, type, relativeTo);
+ if (!res.empty()) {
+ return res;
+ }
+ }
+
+ // Iterate over all registered locators and try to autocomplete the given
+ // path
+ for (auto &locator : locators) {
+ res = locator->autocomplete(path, type, relativeTo);
+ if (!res.empty()) {
+ return res;
+ }
+ }
+ return res;
+}
}