add resource-aliases.json
This commit is contained in:
+10
-1
@@ -137,12 +137,21 @@ public:
|
||||
|
||||
static constexpr size_t MISSING = SIZE_MAX;
|
||||
|
||||
void add(std::string name, dv::value map) {
|
||||
void add(const std::string& name, dv::value map) {
|
||||
indices[name] = names.size();
|
||||
names.push_back(name);
|
||||
savedData->push_back(std::move(map));
|
||||
}
|
||||
|
||||
void addAlias(const std::string& name, const std::string& alias) {
|
||||
size_t index = indexOf(name);
|
||||
if (index == MISSING) {
|
||||
throw std::runtime_error(
|
||||
"resource does not exists: "+name);
|
||||
}
|
||||
indices[alias] = index;
|
||||
}
|
||||
|
||||
const std::string& getName(size_t index) const {
|
||||
return names.at(index);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user