diff options
| author | Michael M <mchtly@gmail.com> | 2017-08-02 16:45:03 -0700 |
|---|---|---|
| committer | Michael M <mchtly@gmail.com> | 2017-08-03 13:16:16 -0700 |
| commit | 7d509a7a947551442b1b486aadd98224d590c8fa (patch) | |
| tree | abc83864f0661204cf5d374843dd612adb28e191 /Source/Core/Common/Config/Section.cpp | |
| parent | 9649494f67b86b91c9086f4a9e356fb832c4a9b7 (diff) | |
Config/Section: support u16 values
Diffstat (limited to 'Source/Core/Common/Config/Section.cpp')
| -rw-r--r-- | Source/Core/Common/Config/Section.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/Source/Core/Common/Config/Section.cpp b/Source/Core/Common/Config/Section.cpp index 7db2c557ea..bb9fcef0e3 100644 --- a/Source/Core/Common/Config/Section.cpp +++ b/Source/Core/Common/Config/Section.cpp @@ -54,6 +54,11 @@ void Section::Set(const std::string& key, const std::string& value) } } +void Section::Set(const std::string& key, u16 newValue) +{ + Section::Set(key, StringFromFormat("0x%04x", newValue)); +} + void Section::Set(const std::string& key, u32 newValue) { Section::Set(key, StringFromFormat("0x%08x", newValue)); @@ -124,6 +129,18 @@ bool Section::Get(const std::string& key, int* value, int defaultValue) const return false; } +bool Section::Get(const std::string& key, u16* value, u16 defaultValue) const +{ + std::string temp; + bool retval = Get(key, &temp); + + if (retval && TryParse(temp, value)) + return true; + + *value = defaultValue; + return false; +} + bool Section::Get(const std::string& key, u32* value, u32 defaultValue) const { std::string temp; |
