Add missing IsDefaultValue to SettingDesc, from upstream

This commit is contained in:
Jonathan G Rennison
2024-01-05 22:16:43 +00:00
parent 0ab4b8ea31
commit a573d065e1
2 changed files with 30 additions and 0 deletions

View File

@@ -831,6 +831,12 @@ bool IntSettingDesc::IsSameValue(const IniItem *item, void *object) const
return item_value == object_value;
}
bool IntSettingDesc::IsDefaultValue(void *object) const
{
int32_t object_value = this->Read(object);
return this->def == object_value;
}
void StringSettingDesc::FormatValue(char *buf, const char *last, const void *object) const
{
const std::string &str = this->Read(object);
@@ -859,12 +865,24 @@ bool StringSettingDesc::IsSameValue(const IniItem *item, void *object) const
return item->value->compare(str) == 0;
}
bool StringSettingDesc::IsDefaultValue(void *object) const
{
const std::string &str = this->Read(object);
return this->def == str;
}
bool ListSettingDesc::IsSameValue(const IniItem *item, void *object) const
{
/* Checking for equality is way more expensive than just writing the value. */
return false;
}
bool ListSettingDesc::IsDefaultValue(void *) const
{
/* Defaults of lists are often complicated, and hard to compare. */
return false;
}
/**
* Loads all items from a 'grpname' section into a list
* The list parameter can be a nullptr pointer, in this case nothing will be