use untemplated trim*
This commit is contained in:
@@ -12,6 +12,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "IniFile.h"
|
#include "IniFile.h"
|
||||||
|
#include "RageUtil.h"
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
@@ -56,8 +57,8 @@ bool IniFile::ReadFile()
|
|||||||
if (line[0] == '[' && line[line.GetLength()-1] == ']') //if a section heading
|
if (line[0] == '[' && line[line.GetLength()-1] == ']') //if a section heading
|
||||||
{
|
{
|
||||||
keyname = line;
|
keyname = line;
|
||||||
keyname.TrimLeft('[');
|
TrimLeft(keyname, "[");
|
||||||
keyname.TrimRight(']');
|
TrimRight(keyname, "]");
|
||||||
}
|
}
|
||||||
else //if a value
|
else //if a value
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -77,8 +77,8 @@ void NoteData::LoadFromSMNoteDataString( CString sSMNoteData )
|
|||||||
for( unsigned m=0; m<asMeasures.size(); m++ ) // foreach measure
|
for( unsigned m=0; m<asMeasures.size(); m++ ) // foreach measure
|
||||||
{
|
{
|
||||||
CString &sMeasureString = asMeasures[m];
|
CString &sMeasureString = asMeasures[m];
|
||||||
sMeasureString.TrimLeft();
|
TrimLeft(sMeasureString);
|
||||||
sMeasureString.TrimRight();
|
TrimRight(sMeasureString);
|
||||||
|
|
||||||
CStringArray asMeasureLines;
|
CStringArray asMeasureLines;
|
||||||
split( sMeasureString, "\n", asMeasureLines, true ); // ignore empty is important
|
split( sMeasureString, "\n", asMeasureLines, true ); // ignore empty is important
|
||||||
@@ -92,8 +92,8 @@ void NoteData::LoadFromSMNoteDataString( CString sSMNoteData )
|
|||||||
for( unsigned l=0; l<asMeasureLines.size(); l++ )
|
for( unsigned l=0; l<asMeasureLines.size(); l++ )
|
||||||
{
|
{
|
||||||
CString &sMeasureLine = asMeasureLines[l];
|
CString &sMeasureLine = asMeasureLines[l];
|
||||||
sMeasureLine.TrimLeft();
|
TrimLeft(sMeasureLine);
|
||||||
sMeasureLine.TrimRight();
|
TrimRight(sMeasureLine);
|
||||||
|
|
||||||
const float fPercentIntoMeasure = l/(float)asMeasureLines.size();
|
const float fPercentIntoMeasure = l/(float)asMeasureLines.size();
|
||||||
const float fBeat = (m + fPercentIntoMeasure) * BEATS_PER_MEASURE;
|
const float fBeat = (m + fPercentIntoMeasure) * BEATS_PER_MEASURE;
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ bool KSFLoader::LoadFromKSFFile( const CString &sPath, Notes &out )
|
|||||||
NoteData notedata; // read it into here
|
NoteData notedata; // read it into here
|
||||||
|
|
||||||
CStringArray asRows;
|
CStringArray asRows;
|
||||||
iStep.TrimLeft();
|
TrimLeft(iStep);
|
||||||
split( iStep, "\n", asRows, true );
|
split( iStep, "\n", asRows, true );
|
||||||
|
|
||||||
int iHoldStartRow[13];
|
int iHoldStartRow[13];
|
||||||
|
|||||||
@@ -17,12 +17,12 @@ void SMLoader::LoadFromSMTokens(
|
|||||||
Notes &out
|
Notes &out
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
sNotesType.TrimLeft();
|
TrimLeft(sNotesType);
|
||||||
sNotesType.TrimRight();
|
TrimRight(sNotesType);
|
||||||
sDescription.TrimLeft();
|
TrimLeft(sDescription);
|
||||||
sDescription.TrimRight();
|
TrimRight(sDescription);
|
||||||
sDifficulty.TrimLeft();
|
TrimLeft(sDifficulty);
|
||||||
sDifficulty.TrimRight();
|
TrimRight(sDifficulty);
|
||||||
|
|
||||||
|
|
||||||
// LOG->Trace( "Notes::LoadFromSMTokens()" );
|
// LOG->Trace( "Notes::LoadFromSMTokens()" );
|
||||||
|
|||||||
@@ -136,8 +136,8 @@ void PlayerOptions::FromString( CString sOptions )
|
|||||||
for( unsigned i=0; i<asBits.size(); i++ )
|
for( unsigned i=0; i<asBits.size(); i++ )
|
||||||
{
|
{
|
||||||
CString& sBit = asBits[i];
|
CString& sBit = asBits[i];
|
||||||
sBit.TrimLeft();
|
TrimLeft(sBit);
|
||||||
sBit.TrimRight();
|
TrimRight(sBit);
|
||||||
|
|
||||||
if( sBit == "0.5x" ) m_fArrowScrollSpeed = 0.5f;
|
if( sBit == "0.5x" ) m_fArrowScrollSpeed = 0.5f;
|
||||||
else if( sBit == "0.75x" ) m_fArrowScrollSpeed = 0.75f;
|
else if( sBit == "0.75x" ) m_fArrowScrollSpeed = 0.75f;
|
||||||
|
|||||||
@@ -366,9 +366,9 @@ bool Song::LoadFromSongDir( CString sDir )
|
|||||||
|
|
||||||
void Song::TidyUpData()
|
void Song::TidyUpData()
|
||||||
{
|
{
|
||||||
m_sMainTitle.TrimRight();
|
TrimRight(m_sMainTitle);
|
||||||
if( m_sMainTitle == "" ) m_sMainTitle = "Untitled song";
|
if( m_sMainTitle == "" ) m_sMainTitle = "Untitled song";
|
||||||
m_sSubTitle.TrimRight();
|
TrimRight(m_sSubTitle);
|
||||||
if( m_sArtist == "" ) m_sArtist = "Unknown artist";
|
if( m_sArtist == "" ) m_sArtist = "Unknown artist";
|
||||||
if( m_BPMSegments.empty() )
|
if( m_BPMSegments.empty() )
|
||||||
throw RageException( "No #BPM specified in '%s%s.'", m_sSongDir.GetString(), m_sSongFileName.GetString() );
|
throw RageException( "No #BPM specified in '%s%s.'", m_sSongDir.GetString(), m_sSongFileName.GetString() );
|
||||||
|
|||||||
@@ -113,7 +113,7 @@ void SongManager::AddGroup( CString sDir, CString sGroupDirName )
|
|||||||
void SongManager::LoadStepManiaSongDir( CString sDir, void(*callback)() )
|
void SongManager::LoadStepManiaSongDir( CString sDir, void(*callback)() )
|
||||||
{
|
{
|
||||||
// trim off the trailing slash if any
|
// trim off the trailing slash if any
|
||||||
sDir.TrimRight( "/\\" );
|
TrimRight( sDir, "/\\" );
|
||||||
|
|
||||||
// Find all group directories in "Songs" folder
|
// Find all group directories in "Songs" folder
|
||||||
CStringArray arrayGroupDirs;
|
CStringArray arrayGroupDirs;
|
||||||
@@ -176,7 +176,7 @@ void SongManager::LoadStepManiaSongDir( CString sDir, void(*callback)() )
|
|||||||
void SongManager::LoadDWISongDir( CString DWIHome )
|
void SongManager::LoadDWISongDir( CString DWIHome )
|
||||||
{
|
{
|
||||||
// trim off the trailing slash if any
|
// trim off the trailing slash if any
|
||||||
DWIHome.TrimRight( "/\\" );
|
TrimRight( DWIHome, "/\\" );
|
||||||
|
|
||||||
// this has to be fixed, DWI doesn't put files
|
// this has to be fixed, DWI doesn't put files
|
||||||
// in it's DWI folder. It puts them in Songs/<MIX>/<SONGNAME>
|
// in it's DWI folder. It puts them in Songs/<MIX>/<SONGNAME>
|
||||||
|
|||||||
@@ -70,8 +70,8 @@ void SongOptions::FromString( CString sOptions )
|
|||||||
for( unsigned i=0; i<asBits.size(); i++ )
|
for( unsigned i=0; i<asBits.size(); i++ )
|
||||||
{
|
{
|
||||||
CString& sBit = asBits[i];
|
CString& sBit = asBits[i];
|
||||||
sBit.TrimLeft();
|
TrimLeft(sBit);
|
||||||
sBit.TrimRight();
|
TrimRight(sBit);
|
||||||
|
|
||||||
if( sBit == "norecover" ) m_DrainType = DRAIN_NO_RECOVER;
|
if( sBit == "norecover" ) m_DrainType = DRAIN_NO_RECOVER;
|
||||||
else if( sBit == "suddendeath" ) m_DrainType = DRAIN_SUDDEN_DEATH;
|
else if( sBit == "suddendeath" ) m_DrainType = DRAIN_SUDDEN_DEATH;
|
||||||
|
|||||||
Reference in New Issue
Block a user