add resource-aliases.json

This commit is contained in:
MihailRis
2024-10-14 07:18:24 +03:00
parent e154bd6ac1
commit 4c3ce8c174
4 changed files with 41 additions and 1 deletions
+10 -1
View File
@@ -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);
}