diff --git a/Jupiter/INIFile.cpp b/Jupiter/INIFile.cpp index a3e18f9..e48aea5 100644 --- a/Jupiter/INIFile.cpp +++ b/Jupiter/INIFile.cpp @@ -127,7 +127,7 @@ const Jupiter::ReadableString &Jupiter::INIFile::Section::getValue(size_t index) return Jupiter::INIFile::Section::data_->data.get(index)->data_->value; } -const Jupiter::ReadableString &Jupiter::INIFile::Section::getValue(const Jupiter::ReadableString &key) const +const Jupiter::ReadableString &Jupiter::INIFile::Section::getValue(const Jupiter::ReadableString &key, const Jupiter::ReadableString &defaultValue) const { Jupiter::INIFile::Section::KeyValuePair *pair; const unsigned int keySum = key.calcChecksumi(); @@ -138,7 +138,7 @@ const Jupiter::ReadableString &Jupiter::INIFile::Section::getValue(const Jupiter if (keySum == pair->getKeyChecksum() && pair->getKey().equalsi(key)) return pair->getValue(); } - return Jupiter::ReferenceString::empty; + return defaultValue; } Jupiter::INIFile::Section::KeyValuePair *Jupiter::INIFile::Section::getPair(size_t index) const diff --git a/Jupiter/INIFile.h b/Jupiter/INIFile.h index 9c73d33..684c7d6 100644 --- a/Jupiter/INIFile.h +++ b/Jupiter/INIFile.h @@ -126,7 +126,7 @@ namespace Jupiter * @param key Key of the key-value pair. * @return Value of a key-value pair, or an empty string if none is found. */ - const Jupiter::ReadableString &getValue(const Jupiter::ReadableString &key) const; + const Jupiter::ReadableString &getValue(const Jupiter::ReadableString &key, const Jupiter::ReadableString &defaultValue = Jupiter::ReferenceString::empty) const; /** * @brief Fetches a key-value pair at a specified index.