Replace StringFromInt with std::to_string

Updated version of #47. Android should support to_string now that
we use a modern version of libc++ when building.
This commit is contained in:
Léo Lam 2017-07-05 13:49:33 +02:00
parent e0b94b55b8
commit 90f8265497
5 changed files with 4 additions and 11 deletions

View File

@ -71,7 +71,7 @@ void Section::Set(const std::string& key, double newValue)
void Section::Set(const std::string& key, int newValue) void Section::Set(const std::string& key, int newValue)
{ {
Section::Set(key, StringFromInt(newValue)); Section::Set(key, std::to_string(newValue));
} }
void Section::Set(const std::string& key, bool newValue) void Section::Set(const std::string& key, bool newValue)

View File

@ -93,7 +93,7 @@ void IniFile::Section::Set(const std::string& key, double newValue)
void IniFile::Section::Set(const std::string& key, int newValue) void IniFile::Section::Set(const std::string& key, int newValue)
{ {
Set(key, StringFromInt(newValue)); Set(key, std::to_string(newValue));
} }
void IniFile::Section::Set(const std::string& key, s64 newValue) void IniFile::Section::Set(const std::string& key, s64 newValue)

View File

@ -283,13 +283,6 @@ bool TryParse(const std::string& str, bool* const output)
return true; return true;
} }
std::string StringFromInt(int value)
{
char temp[16];
sprintf(temp, "%i", value);
return temp;
}
std::string StringFromBool(bool value) std::string StringFromBool(bool value)
{ {
return value ? "True" : "False"; return value ? "True" : "False";

View File

@ -56,7 +56,6 @@ std::string ThousandSeparate(I value, int spaces = 0)
return oss.str(); return oss.str();
} }
std::string StringFromInt(int value);
std::string StringFromBool(bool value); std::string StringFromBool(bool value);
bool TryParse(const std::string& str, bool* output); bool TryParse(const std::string& str, bool* output);

View File

@ -6,6 +6,7 @@
#ifdef ANDROID #ifdef ANDROID
#include <jni.h> #include <jni.h>
#include <string>
#include "Common/StringUtil.h" #include "Common/StringUtil.h"
#include "Core/HW/WiimoteReal/WiimoteReal.h" #include "Core/HW/WiimoteReal/WiimoteReal.h"
@ -17,7 +18,7 @@ class WiimoteAndroid final : public Wiimote
public: public:
WiimoteAndroid(int index); WiimoteAndroid(int index);
~WiimoteAndroid() override; ~WiimoteAndroid() override;
std::string GetId() const override { return "Android " + StringFromInt(m_mayflash_index); } std::string GetId() const override { return "Android " + std::to_string(m_mayflash_index); }
protected: protected:
bool ConnectInternal() override; bool ConnectInternal() override;
void DisconnectInternal() override; void DisconnectInternal() override;