fix input
This commit is contained in:
parent
bccdeec7b8
commit
611c6fa444
@ -239,6 +239,13 @@ const Binding& Bindings::require(const std::string& name) const {
|
|||||||
throw std::runtime_error("binding '" + name + "' does not exist");
|
throw std::runtime_error("binding '" + name + "' does not exist");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Binding& Bindings::require(const std::string& name) {
|
||||||
|
if (const auto found = get(name)) {
|
||||||
|
return *found;
|
||||||
|
}
|
||||||
|
throw std::runtime_error("binding '" + name + "' does not exist");
|
||||||
|
}
|
||||||
|
|
||||||
void Bindings::read(const dv::value& map, BindType bindType) {
|
void Bindings::read(const dv::value& map, BindType bindType) {
|
||||||
for (auto& [sectionName, section] : map.asObject()) {
|
for (auto& [sectionName, section] : map.asObject()) {
|
||||||
for (auto& [name, value] : section.asObject()) {
|
for (auto& [name, value] : section.asObject()) {
|
||||||
|
|||||||
@ -204,7 +204,11 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
Binding* get(const std::string& name) {
|
Binding* get(const std::string& name) {
|
||||||
return const_cast<Bindings*>(this)->get(name);
|
const auto found = bindings.find(name);
|
||||||
|
if (found == bindings.end()) {
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
return &found->second;
|
||||||
}
|
}
|
||||||
|
|
||||||
const Binding* get(const std::string& name) const {
|
const Binding* get(const std::string& name) const {
|
||||||
@ -215,9 +219,7 @@ public:
|
|||||||
return &found->second;
|
return &found->second;
|
||||||
}
|
}
|
||||||
|
|
||||||
Binding& require(const std::string& name) {
|
Binding& require(const std::string& name);
|
||||||
return const_cast<Bindings*>(this)->require(name);
|
|
||||||
}
|
|
||||||
|
|
||||||
const Binding& require(const std::string& name) const;
|
const Binding& require(const std::string& name) const;
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user