Skip to content

Commit 59b99f8

Browse files
remove some rstring use in notesloaders
1 parent 741f5fc commit 59b99f8

12 files changed

Lines changed: 98 additions & 87 deletions

src/Etterna/Models/NoteLoaders/NotesLoader.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,17 @@
1010
#include "NotesLoaderOSU.h"
1111

1212
void
13-
NotesLoader::GetMainAndSubTitlesFromFullTitle(const RString& sFullTitle,
14-
RString& sMainTitleOut,
15-
RString& sSubTitleOut)
13+
NotesLoader::GetMainAndSubTitlesFromFullTitle(const std::string& sFullTitle,
14+
std::string& sMainTitleOut,
15+
std::string& sSubTitleOut)
1616
{
17-
const RString sLeftSeps[] = { "\t", " -", " ~", " (", " [" };
17+
const std::string sLeftSeps[] = { "\t", " -", " ~", " (", " [" };
1818

1919
for (unsigned i = 0; i < ARRAYLEN(sLeftSeps); i++) {
2020
size_t iBeginIndex = sFullTitle.find(sLeftSeps[i]);
2121
if (iBeginIndex == string::npos)
2222
continue;
23-
sMainTitleOut = sFullTitle.Left(static_cast<int>(iBeginIndex));
23+
sMainTitleOut = sFullTitle.substr(0, static_cast<int>(iBeginIndex));
2424
sSubTitleOut = sFullTitle.substr(iBeginIndex + 1,
2525
sFullTitle.size() - iBeginIndex + 1);
2626
return;
@@ -30,11 +30,11 @@ NotesLoader::GetMainAndSubTitlesFromFullTitle(const RString& sFullTitle,
3030
};
3131

3232
bool
33-
NotesLoader::LoadFromDir(const RString& sPath,
33+
NotesLoader::LoadFromDir(const std::string& sPath,
3434
Song& out,
35-
set<RString>& BlacklistedImages)
35+
set<std::string>& BlacklistedImages)
3636
{
37-
vector<RString> list;
37+
vector<std::string> list;
3838

3939
BlacklistedImages.clear();
4040
SSCLoader loaderSSC;

src/Etterna/Models/NoteLoaders/NotesLoader.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,19 +15,19 @@ namespace NotesLoader {
1515
* @param sMainTitleOut the eventual main title.
1616
* @param sSubTitleOut the ventual sub title. */
1717
void
18-
GetMainAndSubTitlesFromFullTitle(const RString& sFullTitle,
19-
RString& sMainTitleOut,
20-
RString& sSubTitleOut);
18+
GetMainAndSubTitlesFromFullTitle(const std::string& sFullTitle,
19+
std::string& sMainTitleOut,
20+
std::string& sSubTitleOut);
2121
/**
2222
* @brief Attempt to load a Song from the given directory.
2323
* @param sPath the path to the file.
2424
* @param out the Song in question.
2525
* @param BlacklistedImages images to exclude (DWI files only for some reason).
2626
* @return its success or failure. */
2727
bool
28-
LoadFromDir(const RString& sPath,
28+
LoadFromDir(const std::string& sPath,
2929
Song& out,
30-
set<RString>& BlacklistedImages);
30+
set<std::string>& BlacklistedImages);
3131
}
3232

3333
#endif

src/Etterna/Models/NoteLoaders/NotesLoaderBMS.cpp

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -122,12 +122,13 @@ SlideDuplicateDifficulties(Song& p)
122122
}
123123

124124
void
125-
BMSLoader::GetApplicableFiles(const RString& sPath, vector<RString>& out)
125+
BMSLoader::GetApplicableFiles(const std::string& sPath,
126+
vector<std::string>& out)
126127
{
127-
GetDirListing(sPath + RString("*.bms"), out);
128-
GetDirListing(sPath + RString("*.bme"), out);
129-
GetDirListing(sPath + RString("*.bml"), out);
130-
GetDirListing(sPath + RString("*.pms"), out);
128+
GetDirListing(sPath + std::string("*.bms"), out);
129+
GetDirListing(sPath + std::string("*.bme"), out);
130+
GetDirListing(sPath + std::string("*.bml"), out);
131+
GetDirListing(sPath + std::string("*.pms"), out);
131132
}
132133

133134
/*===========================================================================*/
@@ -1731,13 +1732,13 @@ BMSLoader::LoadNoteDataFromSimfile(const RString& cachePath, Steps& out)
17311732
}
17321733

17331734
bool
1734-
BMSLoader::LoadFromDir(const RString& sDir, Song& out)
1735+
BMSLoader::LoadFromDir(const std::string& sDir, Song& out)
17351736
{
17361737
LOG->Trace("Song::LoadFromBMSDir(%s)", sDir.c_str());
17371738

17381739
ASSERT(out.m_vsKeysoundFile.empty());
17391740

1740-
vector<RString> arrayBMSFileNames;
1741+
vector<std::string> arrayBMSFileNames;
17411742
GetApplicableFiles(sDir, arrayBMSFileNames);
17421743

17431744
/* We should have at least one; if we had none, we shouldn't have been

src/Etterna/Models/NoteLoaders/NotesLoaderBMS.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
#ifndef NOTES_LOADER_BMS_H
1+
#ifndef NOTES_LOADER_BMS_H
22
#define NOTES_LOADER_BMS_H
33

44
class Song;
55
class Steps;
66
/** @brief Reads a Song from a set of .BMS files. */
77
namespace BMSLoader {
88
void
9-
GetApplicableFiles(const RString& sPath, vector<RString>& out);
9+
GetApplicableFiles(const std::string& sPath, vector<std::string>& out);
1010
bool
11-
LoadFromDir(const RString& sDir, Song& out);
11+
LoadFromDir(const std::string& sDir, Song& out);
1212
bool
1313
LoadNoteDataFromSimfile(const RString& cachePath, Steps& out);
1414
}

src/Etterna/Models/NoteLoaders/NotesLoaderDWI.cpp

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,7 @@ ParseNoteData(RString& step1, RString& step2, Steps& out, const RString& path)
328328
break;
329329
case 1:
330330
if (step2 == "") // no data
331-
continue; // skip
331+
continue; // skip
332332
sStepData = step2;
333333
break;
334334
DEFAULT_FAIL(pad);
@@ -566,7 +566,8 @@ ParseBrokenDWITimestamp(const RString& arg1,
566566
}
567567

568568
void
569-
DWILoader::GetApplicableFiles(const RString& sPath, vector<RString>& out)
569+
DWILoader::GetApplicableFiles(const std::string& sPath,
570+
vector<std::string>& out)
570571
{
571572
GetDirListing(sPath + RString("*.dwi"), out);
572573
}
@@ -612,11 +613,11 @@ DWILoader::LoadNoteDataFromSimfile(const RString& path, Steps& out)
612613
}
613614

614615
bool
615-
DWILoader::LoadFromDir(const RString& sPath_,
616+
DWILoader::LoadFromDir(const std::string& sPath_,
616617
Song& out,
617-
set<RString>& BlacklistedImages)
618+
set<std::string>& BlacklistedImages)
618619
{
619-
vector<RString> aFileNames;
620+
vector<std::string> aFileNames;
620621
GetApplicableFiles(sPath_, aFileNames);
621622

622623
if (aFileNames.size() > 1) {
@@ -629,7 +630,7 @@ DWILoader::LoadFromDir(const RString& sPath_,
629630
/* We should have exactly one; if we had none, we shouldn't have been called
630631
* to begin with. */
631632
ASSERT(aFileNames.size() == 1);
632-
const RString sPath = sPath_ + aFileNames[0];
633+
const std::string sPath = sPath_ + aFileNames[0];
633634

634635
LOG->Trace("Song::LoadFromDWIFile(%s)", sPath.c_str());
635636

@@ -738,11 +739,11 @@ DWILoader::LoadFromDir(const RString& sPath_,
738739
}
739740

740741
else if (sValueName.EqualsNoCase("FREEZE")) {
741-
vector<RString> arrayFreezeExpressions;
742+
vector<std::string> arrayFreezeExpressions;
742743
split(sParams[1], ",", arrayFreezeExpressions);
743744

744745
for (unsigned f = 0; f < arrayFreezeExpressions.size(); f++) {
745-
vector<RString> arrayFreezeValues;
746+
vector<std::string> arrayFreezeValues;
746747
split(arrayFreezeExpressions[f], "=", arrayFreezeValues);
747748
if (arrayFreezeValues.size() != 2) {
748749
LOG->UserLog("Song file",
@@ -765,11 +766,11 @@ DWILoader::LoadFromDir(const RString& sPath_,
765766

766767
else if (sValueName.EqualsNoCase("CHANGEBPM") ||
767768
sValueName.EqualsNoCase("BPMCHANGE")) {
768-
vector<RString> arrayBPMChangeExpressions;
769+
vector<std::string> arrayBPMChangeExpressions;
769770
split(sParams[1], ",", arrayBPMChangeExpressions);
770771

771772
for (unsigned b = 0; b < arrayBPMChangeExpressions.size(); b++) {
772-
vector<RString> arrayBPMChangeValues;
773+
vector<std::string> arrayBPMChangeValues;
773774
split(arrayBPMChangeExpressions[b], "=", arrayBPMChangeValues);
774775
if (arrayBPMChangeValues.size() != 2) {
775776
LOG->UserLog("Song file",
@@ -815,23 +816,24 @@ DWILoader::LoadFromDir(const RString& sPath_,
815816
sValueName.EqualsNoCase("DISPLAYARTIST")) {
816817
/* We don't want to support these tags. However, we don't want
817818
* to pick up images used here as song images (eg. banners). */
818-
RString param = sParams[1];
819+
std::string param = sParams[1];
819820
/* "{foo} ... {foo2}" */
820821
size_t pos = 0;
821-
while (pos < RString::npos) {
822+
while (pos < std::string::npos) {
822823

823824
size_t startpos = param.find('{', pos);
824-
if (startpos == RString::npos)
825+
if (startpos == std::string::npos)
825826
break;
826827
size_t endpos = param.find('}', startpos);
827-
if (endpos == RString::npos)
828+
if (endpos == std::string::npos)
828829
break;
829830

830-
RString sub = param.substr(startpos + 1, endpos - startpos - 1);
831+
std::string sub =
832+
param.substr(startpos + 1, endpos - startpos - 1);
831833

832834
pos = endpos + 1;
833835

834-
sub.MakeLower();
836+
MakeLower(sub);
835837
BlacklistedImages.insert(sub);
836838
}
837839
} else {

src/Etterna/Models/NoteLoaders/NotesLoaderDWI.h

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/** @brief DWILoader - reads a Song from a .DWI file. */
1+
/** @brief DWILoader - reads a Song from a .DWI file. */
22

33
#ifndef NOTES_LOADER_DWI_H
44
#define NOTES_LOADER_DWI_H
@@ -16,7 +16,7 @@ namespace DWILoader {
1616
* @param out a vector of files found in the path.
1717
*/
1818
void
19-
GetApplicableFiles(const RString& sPath, vector<RString>& out);
19+
GetApplicableFiles(const std::string& sPath, vector<std::string>& out);
2020
/**
2121
* @brief Attempt to load a song from a specified path.
2222
* @param sPath a const reference to the path on the hard drive to check.
@@ -25,7 +25,9 @@ GetApplicableFiles(const RString& sPath, vector<RString>& out);
2525
* @return its success or failure.
2626
*/
2727
bool
28-
LoadFromDir(const RString& sPath, Song& out, set<RString>& BlacklistedImages);
28+
LoadFromDir(const std::string& sPath,
29+
Song& out,
30+
set<std::string>& BlacklistedImages);
2931

3032
bool
3133
LoadNoteDataFromSimfile(const RString& path, Steps& out);

src/Etterna/Models/NoteLoaders/NotesLoaderKSF.cpp

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -495,11 +495,15 @@ LoadGlobalData(const RString& sPath, Song& out, bool& bKIUCompliant)
495495

496496
// changed up there in case of something is found inside the SONGFILE tag in
497497
// the head ksf -DaisuMaster search for music with song in the file name
498-
vector<RString> arrayPossibleMusic;
499-
GetDirListing(out.GetSongDir() + RString("song.mp3"), arrayPossibleMusic);
500-
GetDirListing(out.GetSongDir() + RString("song.oga"), arrayPossibleMusic);
501-
GetDirListing(out.GetSongDir() + RString("song.ogg"), arrayPossibleMusic);
502-
GetDirListing(out.GetSongDir() + RString("song.wav"), arrayPossibleMusic);
498+
vector<std::string> arrayPossibleMusic;
499+
GetDirListing(out.GetSongDir() + std::string("song.mp3"),
500+
arrayPossibleMusic);
501+
GetDirListing(out.GetSongDir() + std::string("song.oga"),
502+
arrayPossibleMusic);
503+
GetDirListing(out.GetSongDir() + std::string("song.ogg"),
504+
arrayPossibleMusic);
505+
GetDirListing(out.GetSongDir() + std::string("song.wav"),
506+
arrayPossibleMusic);
503507

504508
if (!arrayPossibleMusic.empty()) // we found a match
505509
out.m_sMusicFile = arrayPossibleMusic[0];
@@ -632,7 +636,7 @@ LoadGlobalData(const RString& sPath, Song& out, bool& bKIUCompliant)
632636

633637
// Try to fill in missing bits of information from the pathname.
634638
{
635-
vector<RString> asBits;
639+
vector<std::string> asBits;
636640
split(sPath, "/", asBits, true);
637641

638642
ASSERT(asBits.size() > 1);
@@ -643,13 +647,14 @@ LoadGlobalData(const RString& sPath, Song& out, bool& bKIUCompliant)
643647
}
644648

645649
void
646-
KSFLoader::GetApplicableFiles(const RString& sPath, vector<RString>& out)
650+
KSFLoader::GetApplicableFiles(const std::string& sPath,
651+
vector<std::string>& out)
647652
{
648653
GetDirListing(sPath + RString("*.ksf"), out);
649654
}
650655

651656
bool
652-
KSFLoader::LoadNoteDataFromSimfile(const RString& cachePath, Steps& out)
657+
KSFLoader::LoadNoteDataFromSimfile(const std::string& cachePath, Steps& out)
653658
{
654659
bool KIUCompliant = false;
655660
Song dummy;
@@ -665,12 +670,12 @@ KSFLoader::LoadNoteDataFromSimfile(const RString& cachePath, Steps& out)
665670
}
666671

667672
bool
668-
KSFLoader::LoadFromDir(const RString& sDir, Song& out)
673+
KSFLoader::LoadFromDir(const std::string& sDir, Song& out)
669674
{
670675
LOG->Trace("KSFLoader::LoadFromDir(%s)", sDir.c_str());
671676

672-
vector<RString> arrayKSFFileNames;
673-
GetDirListing(sDir + RString("*.ksf"), arrayKSFFileNames);
677+
vector<std::string> arrayKSFFileNames;
678+
GetDirListing(sDir + std::string("*.ksf"), arrayKSFFileNames);
674679

675680
// We shouldn't have been called to begin with if there were no KSFs.
676681
ASSERT(arrayKSFFileNames.size() != 0);
@@ -694,7 +699,7 @@ KSFLoader::LoadFromDir(const RString& sDir, Song& out)
694699
// and most of the time all the KSF files have the same info in the #TITLE:;
695700
// section
696701
unsigned files = arrayKSFFileNames.size();
697-
RString dir = out.GetSongDir();
702+
std::string dir = out.GetSongDir();
698703
if (!LoadGlobalData(dir + arrayKSFFileNames[files - 1], out, bKIUCompliant))
699704
return false;
700705

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
1-
#ifndef NOTES_LOADER_KSF_H
1+
#ifndef NOTES_LOADER_KSF_H
22
#define NOTES_LOADER_KSF_H
33

44
class Song;
55
class Steps;
66
/** @brief Reads a Song from a set of .KSF files. */
77
namespace KSFLoader {
88
void
9-
GetApplicableFiles(const RString& sPath, vector<RString>& out);
9+
GetApplicableFiles(const std::string& sPath, vector<std::string>& out);
1010
bool
11-
LoadFromDir(const RString& sDir, Song& out);
11+
LoadFromDir(const std::string& sDir, Song& out);
1212
bool
13-
LoadNoteDataFromSimfile(const RString& cachePath, Steps& out);
13+
LoadNoteDataFromSimfile(const std::string& cachePath, Steps& out);
1414
}
1515

1616
#endif

src/Etterna/Models/NoteLoaders/NotesLoaderOSU.cpp

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -250,9 +250,10 @@ OsuLoader::LoadChartData(Song* song,
250250
}
251251

252252
void
253-
OsuLoader::GetApplicableFiles(const RString& sPath, vector<RString>& out)
253+
OsuLoader::GetApplicableFiles(const std::string& sPath,
254+
vector<std::string>& out)
254255
{
255-
GetDirListing(sPath + RString("*.osu"), out);
256+
GetDirListing(sPath + std::string("*.osu"), out);
256257
}
257258

258259
int
@@ -275,7 +276,7 @@ OsuLoader::MsToNoteRow(int ms, Song* song)
275276
void
276277
OsuLoader::LoadNoteDataFromParsedData(
277278
Steps* out,
278-
map<string, map<string, string>> parsedData)
279+
map<std::string, map<std::string, std::string>> parsedData)
279280
{
280281
NoteData newNoteData;
281282
newNoteData.SetNumTracks(stoi(parsedData["Difficulty"]["CircleSize"]));
@@ -344,7 +345,7 @@ OsuLoader::LoadNoteDataFromParsedData(
344345
}
345346

346347
bool
347-
OsuLoader::LoadNoteDataFromSimfile(const RString& path, Steps& out)
348+
OsuLoader::LoadNoteDataFromSimfile(const std::string& path, Steps& out)
348349
{
349350
RageFile f;
350351
if (!f.Open(path)) {
@@ -365,17 +366,17 @@ OsuLoader::LoadNoteDataFromSimfile(const RString& path, Steps& out)
365366
}
366367

367368
bool
368-
OsuLoader::LoadFromDir(const RString& sPath_, Song& out)
369+
OsuLoader::LoadFromDir(const std::string& sPath_, Song& out)
369370
{
370-
vector<RString> aFileNames;
371+
vector<std::string> aFileNames;
371372
GetApplicableFiles(sPath_, aFileNames);
372373

373374
// const RString sPath = sPath_ + aFileNames[0];
374375

375376
// LOG->Trace("Song::LoadFromDWIFile(%s)", sPath.c_str()); //osu
376377

377378
RageFile f;
378-
map<string, map<string, string>> parsedData;
379+
map<std::string, map<std::string, std::string>> parsedData;
379380

380381
for (auto& filename : aFileNames) {
381382
auto p = sPath_ + filename;

0 commit comments

Comments
 (0)