diff options
| author | hrydgard <hrydgard@gmail.com> | 2010-06-04 19:56:34 +0000 |
|---|---|---|
| committer | hrydgard <hrydgard@gmail.com> | 2010-06-04 19:56:34 +0000 |
| commit | 05c418ebe2da24a8df4ef2c1d1d7864eb2d806e3 (patch) | |
| tree | 0a8dd75e6505458ca28eb4066fd0887645dd5ea6 /Source/Core/Common/Src/StringUtil.cpp | |
| parent | 1435c2527add244b7e1590b20e1e4db56b9e0108 (diff) | |
Refactor the original and much more compatible IniFile implementation to work more like Billiard's, with a public Section interface, but keep the old interface as well.
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@5603 8ced0084-cf51-0410-be5f-012b33b47a6e
Diffstat (limited to 'Source/Core/Common/Src/StringUtil.cpp')
| -rw-r--r-- | Source/Core/Common/Src/StringUtil.cpp | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/Source/Core/Common/Src/StringUtil.cpp b/Source/Core/Common/Src/StringUtil.cpp index b0d3d2e0e3..5165363094 100644 --- a/Source/Core/Common/Src/StringUtil.cpp +++ b/Source/Core/Common/Src/StringUtil.cpp @@ -244,7 +244,6 @@ bool TryParseInt(const char* str, int* outVal) return true; } - bool TryParseBool(const char* str, bool* output) { if ((str[0] == '1') || !strcasecmp(str, "true")) @@ -260,6 +259,25 @@ bool TryParseBool(const char* str, bool* output) return false; } +bool TryParseFloat(const char* str, float *output) +{ + double d_val; + if (sscanf(str, "%f", &d_val) == 1) + { + *output = (float)d_val; + return true; + } + else + { + return false; + } +} + +bool TryParseDouble(const char* str, double *output) +{ + return sscanf(str, "%f", output) == 1; +} + std::string StringFromInt(int value) { char temp[16]; |
