Skip to content

Commit

Permalink
Merge pull request #232 from kivancsikert/config/read-only
Browse files Browse the repository at this point in the history
Do not allow properties to be set
  • Loading branch information
lptr authored Oct 23, 2024
2 parents f02654f + edfe28c commit 0c5b0c8
Showing 1 changed file with 3 additions and 10 deletions.
13 changes: 3 additions & 10 deletions main/kernel/Configuration.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -184,22 +184,19 @@ class Property : public ConfigurationEntry {
Property(ConfigurationSection* parent, const String& name, const T& defaultValue = T(), const bool secret = false)
: name(name)
, secret(secret)
, value(defaultValue)
, defaultValue(defaultValue) {
parent->add(*this);
}

void set(const T& value) {
this->value = value;
configured = true;
}

const T& get() const {
return configured ? value : defaultValue;
}

void load(const JsonObject& json) override {
if (json[name].is<JsonVariant>()) {
set(json[name].as<T>());
value = json[name].as<T>();
configured = true;
} else {
reset();
}
Expand Down Expand Up @@ -241,10 +238,6 @@ class ArrayProperty : public ConfigurationEntry {
parent->add(*this);
}

void set(const std::list<T>& entries) {
this->entries = entries;
}

const std::list<T>& get() const {
return entries;
}
Expand Down

0 comments on commit 0c5b0c8

Please sign in to comment.