From 05c418ebe2da24a8df4ef2c1d1d7864eb2d806e3 Mon Sep 17 00:00:00 2001 From: hrydgard Date: Fri, 4 Jun 2010 19:56:34 +0000 Subject: 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 --- Source/Core/Common/Src/StringUtil.cpp | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) (limited to 'Source/Core/Common/Src/StringUtil.cpp') 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]; -- cgit v1.2.3