Remove the IntToString function, use std.

...this seriously didn't belong in Rage.
This commit is contained in:
Jason Felds
2013-05-04 11:22:10 -04:00
parent 07b9fb6da5
commit 490327cf55
4 changed files with 268 additions and 280 deletions
-7
View File
@@ -1758,13 +1758,6 @@ int StringToInt( const RString &sString )
return ret; return ret;
} }
RString IntToString( const int &iNum )
{
stringstream ss;
ss << iNum;
return ss.str();
}
float StringToFloat( const RString &sString ) float StringToFloat( const RString &sString )
{ {
float ret = strtof( sString, nullptr ); float ret = strtof( sString, nullptr );
-5
View File
@@ -410,11 +410,6 @@ void MakeLower( wchar_t *p, size_t iLen );
* @param sString the string to convert. * @param sString the string to convert.
* @return the integer we are after. */ * @return the integer we are after. */
int StringToInt( const RString &sString ); int StringToInt( const RString &sString );
/**
* @brief Have a standard way of converting integers to Strings.
* @param iNum the integer to convert.
* @return the string we are after. */
RString IntToString( const int &iNum );
float StringToFloat( const RString &sString ); float StringToFloat( const RString &sString );
RString FloatToString( const float &num ); RString FloatToString( const float &num );
bool StringToFloat( const RString &sString, float &fOut ); bool StringToFloat( const RString &sString, float &fOut );
+1 -1
View File
@@ -98,7 +98,7 @@ struct MenuRowDef
{ {
for ( int i = low; i <= high; i++ ) for ( int i = low; i <= high; i++ )
{ {
choices.push_back(IntToString(i).c_str()); choices.push_back(std::to_string(i));
} }
} }
+19 -19
View File
@@ -121,8 +121,8 @@ void FakeSegment::DebugPrint() const
RString FakeSegment::ToString(int dec) const RString FakeSegment::ToString(int dec) const
{ {
RString str = "%.0" + IntToString(dec) RString str = "%.0" + std::to_string(dec)
+ "f=%.0" + IntToString(dec) + "f"; + "f=%.0" + std::to_string(dec) + "f";
return ssprintf(str.c_str(), GetBeat(), GetLength()); return ssprintf(str.c_str(), GetBeat(), GetLength());
} }
@@ -138,8 +138,8 @@ void FakeSegment::Scale( int start, int length, int newLength )
RString WarpSegment::ToString(int dec) const RString WarpSegment::ToString(int dec) const
{ {
RString str = "%.0" + IntToString(dec) RString str = "%.0" + std::to_string(dec)
+ "f=%.0" + IntToString(dec) + "f"; + "f=%.0" + std::to_string(dec) + "f";
return ssprintf(str.c_str(), GetBeat(), GetLength()); return ssprintf(str.c_str(), GetBeat(), GetLength());
} }
@@ -156,12 +156,12 @@ void WarpSegment::Scale( int start, int length, int newLength )
RString TickcountSegment::ToString(int dec) const RString TickcountSegment::ToString(int dec) const
{ {
const RString str = "%.0" + IntToString(dec) + "f=%i"; const RString str = "%.0" + std::to_string(dec) + "f=%i";
return ssprintf(str.c_str(), GetBeat(), GetTicks()); return ssprintf(str.c_str(), GetBeat(), GetTicks());
} }
RString ComboSegment::ToString(int dec) const RString ComboSegment::ToString(int dec) const
{ {
RString str = "%.0" + IntToString(dec) + "f=%i"; RString str = "%.0" + std::to_string(dec) + "f=%i";
if (GetCombo() == GetMissCombo()) if (GetCombo() == GetMissCombo())
{ {
return ssprintf(str.c_str(), GetBeat(), GetCombo()); return ssprintf(str.c_str(), GetBeat(), GetCombo());
@@ -172,28 +172,28 @@ RString ComboSegment::ToString(int dec) const
RString LabelSegment::ToString(int dec) const RString LabelSegment::ToString(int dec) const
{ {
const RString str = "%.0" + IntToString(dec) + "f=%s"; const RString str = "%.0" + std::to_string(dec) + "f=%s";
return ssprintf(str.c_str(), GetBeat(), GetLabel().c_str()); return ssprintf(str.c_str(), GetBeat(), GetLabel().c_str());
} }
RString BPMSegment::ToString(int dec) const RString BPMSegment::ToString(int dec) const
{ {
const RString str = "%.0" + IntToString(dec) const RString str = "%.0" + std::to_string(dec)
+ "f=%.0" + IntToString(dec) + "f"; + "f=%.0" + std::to_string(dec) + "f";
return ssprintf(str.c_str(), GetBeat(), GetBPM()); return ssprintf(str.c_str(), GetBeat(), GetBPM());
} }
RString TimeSignatureSegment::ToString(int dec) const RString TimeSignatureSegment::ToString(int dec) const
{ {
const RString str = "%.0" + IntToString(dec) + "f=%i=%i"; const RString str = "%.0" + std::to_string(dec) + "f=%i=%i";
return ssprintf(str.c_str(), GetBeat(), GetNum(), GetDen()); return ssprintf(str.c_str(), GetBeat(), GetNum(), GetDen());
} }
RString SpeedSegment::ToString(int dec) const RString SpeedSegment::ToString(int dec) const
{ {
const RString str = "%.0" + IntToString(dec) const RString str = "%.0" + std::to_string(dec)
+ "f=%.0" + IntToString(dec) + "f=%.0" + "f=%.0" + std::to_string(dec) + "f=%.0"
+ IntToString(dec) + "f=%u"; + std::to_string(dec) + "f=%u";
return ssprintf(str.c_str(), GetBeat(), GetRatio(), return ssprintf(str.c_str(), GetBeat(), GetRatio(),
GetDelay(), GetUnit()); GetDelay(), GetUnit());
} }
@@ -220,22 +220,22 @@ void SpeedSegment::Scale( int start, int oldLength, int newLength )
RString ScrollSegment::ToString(int dec) const RString ScrollSegment::ToString(int dec) const
{ {
const RString str = "%.0" + IntToString(dec) const RString str = "%.0" + std::to_string(dec)
+ "f=%.0" + IntToString(dec) + "f"; + "f=%.0" + std::to_string(dec) + "f";
return ssprintf(str.c_str(), GetBeat(), GetRatio()); return ssprintf(str.c_str(), GetBeat(), GetRatio());
} }
RString StopSegment::ToString(int dec) const RString StopSegment::ToString(int dec) const
{ {
const RString str = "%.0" + IntToString(dec) const RString str = "%.0" + std::to_string(dec)
+ "f=%.0" + IntToString(dec) + "f"; + "f=%.0" + std::to_string(dec) + "f";
return ssprintf(str.c_str(), GetBeat(), GetPause()); return ssprintf(str.c_str(), GetBeat(), GetPause());
} }
RString DelaySegment::ToString(int dec) const RString DelaySegment::ToString(int dec) const
{ {
const RString str = "%.0" + IntToString(dec) const RString str = "%.0" + std::to_string(dec)
+ "f=%.0" + IntToString(dec) + "f"; + "f=%.0" + std::to_string(dec) + "f";
return ssprintf(str.c_str(), GetBeat(), GetPause()); return ssprintf(str.c_str(), GetBeat(), GetPause());
} }