Skip to content

Commit

Permalink
just remove all the rstring references
Browse files Browse the repository at this point in the history
gone
no more
  • Loading branch information
poco0317 committed Jul 9, 2020
1 parent 97d1611 commit 19501c3
Show file tree
Hide file tree
Showing 20 changed files with 60 additions and 62 deletions.
14 changes: 7 additions & 7 deletions src/Etterna/Actor/Base/BitmapText.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -566,7 +566,7 @@ BitmapText::SetTextInternal()
m_wTextLines.clear();

if (m_iWrapWidthPixels == -1) {
split(RStringToWstring(m_sText), L"\n", m_wTextLines, false);
split(StringToWString(m_sText), L"\n", m_wTextLines, false);
} else {
// Break sText into lines that don't exceed iWrapWidthPixels. (if only
// one word fits on the line, it may be larger than iWrapWidthPixels).
Expand All @@ -587,7 +587,7 @@ BitmapText::SetTextInternal()

for (auto& sWord : asWords) {
const auto iWidthWord =
m_pFont->GetLineWidthInSourcePixels(RStringToWstring(sWord));
m_pFont->GetLineWidthInSourcePixels(StringToWString(sWord));

if (sCurLine.empty()) {
sCurLine = sWord;
Expand All @@ -604,12 +604,12 @@ BitmapText::SetTextInternal()
sCurLine += sToAdd;
iCurLineWidth += iWidthToAdd;
} else {
m_wTextLines.push_back(RStringToWstring(sCurLine));
m_wTextLines.push_back(StringToWString(sCurLine));
sCurLine = sWord;
iCurLineWidth = iWidthWord;
}
}
m_wTextLines.push_back(RStringToWstring(sCurLine));
m_wTextLines.push_back(StringToWString(sCurLine));
}
}

Expand Down Expand Up @@ -718,11 +718,11 @@ BitmapText::StringWillUseAlternate(const std::string& sText,
return false;

// False if the alternate isn't needed.
if (m_pFont->FontCompleteForString(RStringToWstring(sText)))
if (m_pFont->FontCompleteForString(StringToWString(sText)))
return false;

// False if the alternate is also incomplete.
if (!m_pFont->FontCompleteForString(RStringToWstring(sAlternateText)))
if (!m_pFont->FontCompleteForString(StringToWString(sAlternateText)))
return false;

return true;
Expand Down Expand Up @@ -1341,7 +1341,7 @@ void
ColorBitmapText::SimpleAddLine(const std::string& sAddition,
const int iWidthPixels)
{
m_wTextLines.push_back(RStringToWstring(sAddition));
m_wTextLines.push_back(StringToWString(sAddition));
m_iLineWidths.push_back(iWidthPixels);
}

Expand Down
2 changes: 1 addition & 1 deletion src/Etterna/Actor/GameplayAndMenus/BGAnimation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ BGAnimation::LoadFromAniDir(const std::string& _sAniDir)
GetDirListing(sAniDir + "*.mpg", asImagePaths, false, true);
GetDirListing(sAniDir + "*.mpeg", asImagePaths, false, true);

SortRStringArray(asImagePaths);
SortStringArray(asImagePaths);

for (auto& sPath : asImagePaths) {
if (Basename(sPath).front() == '_')
Expand Down
2 changes: 1 addition & 1 deletion src/Etterna/Models/Fonts/Font.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -670,7 +670,7 @@ Font::LoadFontPageSettings(FontPageSettings& cfg,

// Decode the std::string.
const wstring wdata(
RStringToWstring(pValue->GetValue<std::string>()));
StringToWString(pValue->GetValue<std::string>()));

if (static_cast<int>(wdata.size()) > num_frames_wide) {
LuaHelpers::ReportScriptErrorFmt(
Expand Down
4 changes: 2 additions & 2 deletions src/Etterna/Models/Misc/Profile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -453,10 +453,10 @@ Profile::LoadEditableDataFromDir(const std::string& sDir)
ini.GetValue("Editable", "LastUsedHighScoreName", m_sLastUsedHighScoreName);

// This is data that the user can change, so we have to validate it.
auto wstr = RStringToWstring(m_sDisplayName);
auto wstr = StringToWString(m_sDisplayName);
if (wstr.size() > PROFILE_MAX_DISPLAY_NAME_LENGTH)
wstr = wstr.substr(0, PROFILE_MAX_DISPLAY_NAME_LENGTH);
m_sDisplayName = WStringToRString(wstr);
m_sDisplayName = WStringToString(wstr);
// TODO: strip invalid chars?

return ProfileLoadResult_Success;
Expand Down
2 changes: 1 addition & 1 deletion src/Etterna/Models/NoteLoaders/NotesLoaderSMA.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ SMALoader::ProcessSpeeds(TimingData& out,
// Aldo_MX: 4 is the default value in SMA, although SM5 requires 0
// for the first segment :/
// dunno what this is doing or if this is right (used to be implicit
// conversion of rstring compared to vs1.begin()
// conversion of string compared to vs1.begin()
vs2.push_back(s1 == vs1[0] ? "0" : "4");
}

Expand Down
4 changes: 2 additions & 2 deletions src/Etterna/Models/Songs/SongUtil.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,7 @@ CompareSongPointersByBPM(const Song* pSong1, const Song* pSong2)
if (bpms1.GetMax() > bpms2.GetMax())
return false;

return CompareRStringsAsc(pSong1->GetSongFilePath(),
return CompareStringsAsc(pSong1->GetSongFilePath(),
pSong2->GetSongFilePath());
}

Expand Down Expand Up @@ -447,7 +447,7 @@ CompareSongPointersByLength(const Song* a, const Song* b)
if (len_a > len_b)
return false;

return CompareRStringsAsc(a->GetSongFilePath(), b->GetSongFilePath());
return CompareStringsAsc(a->GetSongFilePath(), b->GetSongFilePath());
}

void
Expand Down
2 changes: 1 addition & 1 deletion src/Etterna/Screen/Network/ScreenNetSelectBase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ ScreenNetSelectBase::Input(const InputEventPlus& input)
wchar_t c;
c = INPUTMAN->DeviceInputToChar(input.DeviceI, true);
if (c >= L' ' && enableChatboxInput) {
m_sTextInput += WStringToRString(std::wstring() + c);
m_sTextInput += WStringToString(std::wstring() + c);
UpdateTextInput();
return true;
}
Expand Down
4 changes: 2 additions & 2 deletions src/Etterna/Screen/Options/ScreenOptionsMasterPrefs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ LanguageChoices(vector<std::string>& out)
{
vector<std::string> vs;
THEME->GetLanguages(vs);
SortRStringArray(vs, true);
SortStringArray(vs, true);

for (auto& s : vs) {
const LanguageInfo* pLI = GetLanguageInfo(s);
Expand All @@ -222,7 +222,7 @@ Language(int& sel, bool ToSel, const ConfOption* pConfOption)
{
vector<std::string> vs;
THEME->GetLanguages(vs);
SortRStringArray(vs, true);
SortStringArray(vs, true);

if (ToSel) {
sel = -1;
Expand Down
2 changes: 1 addition & 1 deletion src/Etterna/Screen/Others/ScreenSelectLanguage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ ScreenSelectLanguage::Init()
// fill m_aGameCommands before calling Init()
vector<std::string> vs;
THEME->GetLanguages(vs);
SortRStringArray(vs, true);
SortStringArray(vs, true);

FOREACH_CONST(std::string, vs, s)
{
Expand Down
24 changes: 12 additions & 12 deletions src/Etterna/Screen/Others/ScreenTextEntry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -378,9 +378,9 @@ void
ScreenTextEntry::BeginScreen()
{
if (sInitialAnswer != "")
m_sAnswer = RStringToWstring(sInitialAnswer);
m_sAnswer = StringToWString(sInitialAnswer);
else
m_sAnswer = RStringToWstring(g_sInitialAnswer);
m_sAnswer = StringToWString(g_sInitialAnswer);

ScreenWithMenuElements::BeginScreen();

Expand All @@ -403,7 +403,7 @@ ScreenTextEntry::UpdateAnswerText()
if (g_bPassword || bPassword)
s = std::string(m_sAnswer.size(), '*');
else
s = WStringToRString(m_sAnswer);
s = WStringToString(m_sAnswer);

bool bAnswerFull = static_cast<int>(s.length()) >=
std::max(g_iMaxInputLength, iMaxInputLength);
Expand Down Expand Up @@ -470,7 +470,7 @@ ScreenTextEntry::Input(const InputEventPlus& input)
bHandled = true;
} else if (c >= L' ') {
// todo: handle caps lock -aj
auto str = WStringToRString(std::wstring() + c);
auto str = WStringToString(std::wstring() + c);
TryAppendToAnswer(str);

TextEnteredDirectly();
Expand All @@ -485,7 +485,7 @@ void
ScreenTextEntry::TryAppendToAnswer(const std::string& s)
{
{
std::wstring sNewAnswer = m_sAnswer + RStringToWstring(s);
std::wstring sNewAnswer = m_sAnswer + StringToWString(s);
if (static_cast<int>(sNewAnswer.length()) >
std::max(g_iMaxInputLength, iMaxInputLength)) {
SCREENMAN->PlayInvalidSound();
Expand All @@ -495,19 +495,19 @@ ScreenTextEntry::TryAppendToAnswer(const std::string& s)

if (!ValidateAppendFunc.IsNil() && ValidateAppendFunc.IsSet()) {
ValidateAppendFromLua(
WStringToRString(m_sAnswer), s, ValidateAppendFunc);
WStringToString(m_sAnswer), s, ValidateAppendFunc);
} else if (pValidateAppend != nullptr) {
if (!pValidateAppend(WStringToRString(m_sAnswer), s)) {
if (!pValidateAppend(WStringToString(m_sAnswer), s)) {
SCREENMAN->PlayInvalidSound();
return;
}
} else if (g_pValidateAppend &&
!g_pValidateAppend(WStringToRString(m_sAnswer), s)) {
!g_pValidateAppend(WStringToString(m_sAnswer), s)) {
SCREENMAN->PlayInvalidSound();
return;
}

std::wstring sNewAnswer = m_sAnswer + RStringToWstring(s);
std::wstring sNewAnswer = m_sAnswer + StringToWString(s);
m_sAnswer = sNewAnswer;
m_sndType.Play(true);
UpdateAnswerText();
Expand Down Expand Up @@ -551,7 +551,7 @@ ScreenTextEntry::End(bool bCancelled)
Cancel(SM_GoToNextScreen);
// TweenOffScreen();
} else {
std::string sAnswer = WStringToRString(m_sAnswer);
std::string sAnswer = WStringToString(m_sAnswer);
std::string sError;

if (!ValidateFunc.IsNil() && ValidateFunc.IsSet()) {
Expand All @@ -570,7 +570,7 @@ ScreenTextEntry::End(bool bCancelled)
}
}

std::string ret = WStringToRString(m_sAnswer);
std::string ret = WStringToString(m_sAnswer);
FontCharAliases::ReplaceMarkers(ret);
if (!OnOKFunc.IsNil() && OnOKFunc.IsSet()) {
OnOKFromLua(ret, OnOKFunc);
Expand All @@ -585,7 +585,7 @@ ScreenTextEntry::End(bool bCancelled)
}

s_bCancelledLast = bCancelled;
s_sLastAnswer = bCancelled ? std::string("") : WStringToRString(m_sAnswer);
s_sLastAnswer = bCancelled ? std::string("") : WStringToString(m_sAnswer);
}

bool
Expand Down
2 changes: 1 addition & 1 deletion src/Etterna/Singletons/SongManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ class SongManager
auto operator()(const std::string& s, const std::string& t) const
-> bool
{
return CompareRStringsAsc(s, t);
return CompareStringsAsc(s, t);
}
};
using SongPointerVector = std::vector<Song*>;
Expand Down
2 changes: 1 addition & 1 deletion src/Etterna/Singletons/ThemeManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -537,7 +537,7 @@ ThemeManager::RunLuaScripts(const std::string& sMask, bool bUseThemeDir)
vector<std::string> asElementChildPaths;
vector<std::string> arrayScriptDirs;
GetDirListing(sScriptDir + "Scripts/*", arrayScriptDirs, true);
SortRStringArray(arrayScriptDirs);
SortStringArray(arrayScriptDirs);
for (auto& s : arrayScriptDirs) // foreach dir in /Scripts/
{
// Find all Lua files in this directory, add them to asElementPaths
Expand Down
28 changes: 13 additions & 15 deletions src/RageUtil/Utils/RageUtil.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,6 @@ ends_with(std::string const& source, std::string const& target)
tail(source, target.size()) == target;
}

/* Stuff taken from ragestring.cpp where they already got rid of rstring
* apparently /shrug */
void
s_replace(std::string& target, std::string const& from, std::string const& to)
{
Expand Down Expand Up @@ -840,8 +838,8 @@ do_split(const S& Source,
if (startpos == 0 && pos - startpos == Source.size())
AddIt.push_back(Source);
else {
const S AddRString = Source.substr(startpos, pos - startpos);
AddIt.push_back(AddRString);
const S AddString = Source.substr(startpos, pos - startpos);
AddIt.push_back(AddString);
}
}

Expand Down Expand Up @@ -1024,7 +1022,7 @@ GetFileNameWithoutExtension(const std::string& sPath)
void
MakeValidFilename(std::string& sName)
{
auto wsName = RStringToWstring(sName);
auto wsName = StringToWString(sName);
const wstring wsInvalid = L"/\\:*?\"<>|";
for (auto& i : wsName) {
const auto w = i;
Expand All @@ -1044,7 +1042,7 @@ MakeValidFilename(std::string& sName)
i = '_';
}

sName = WStringToRString(wsName);
sName = WStringToString(wsName);
}

bool
Expand Down Expand Up @@ -1206,23 +1204,23 @@ DirectoryIsEmpty(const std::string& sDir)
}

bool
CompareRStringsAsc(const std::string& a, const std::string& b)
CompareStringsAsc(const std::string& a, const std::string& b)
{
return CompareNoCase(a, b) > 0;
}

bool
CompareRStringsDesc(const std::string& a, const std::string& b)
CompareStringsDesc(const std::string& a, const std::string& b)
{
return CompareNoCase(b, a) > 0;
}

void
SortRStringArray(vector<std::string>& arrayRStrings, const bool bSortAscending)
SortStringArray(vector<std::string>& arrayStrings, const bool bSortAscending)
{
sort(arrayRStrings.begin(),
arrayRStrings.end(),
bSortAscending ? CompareRStringsAsc : CompareRStringsDesc);
sort(arrayStrings.begin(),
arrayStrings.end(),
bSortAscending ? CompareStringsAsc : CompareStringsDesc);
}

float
Expand Down Expand Up @@ -1856,7 +1854,7 @@ FloatToString(const float& num)
const wchar_t INVALID_CHAR = 0xFFFD; /* U+FFFD REPLACEMENT CHARACTER */

wstring
RStringToWstring(const std::string& s)
StringToWString(const std::string& s)
{
wstring ret;
ret.reserve(s.size());
Expand All @@ -1879,7 +1877,7 @@ RStringToWstring(const std::string& s)
}

std::string
WStringToRString(const wstring& sStr)
WStringToString(const wstring& sStr)
{
std::string sRet;

Expand Down Expand Up @@ -2413,7 +2411,7 @@ LuaFunction(Lowercase, MakeLower(SArg(1))) static std::string
return make_upper(s);
}
LuaFunction(Uppercase, MakeUpper(SArg(1)))
LuaFunction(mbstrlen, static_cast<int>(RStringToWstring(SArg(1)).length()))
LuaFunction(mbstrlen, static_cast<int>(StringToWString(SArg(1)).length()))
LuaFunction(URLEncode, URLEncode(SArg(1)));
LuaFunction(PrettyPercent, PrettyPercent(FArg(1), FArg(2)));
// LuaFunction( IsHexVal, IsHexVal( SArg(1) ) );
Expand Down
10 changes: 5 additions & 5 deletions src/RageUtil/Utils/RageUtil.h
Original file line number Diff line number Diff line change
Expand Up @@ -650,11 +650,11 @@ operator>>(const std::string& lhs, T& rhs) -> bool
}

auto
WStringToRString(const std::wstring& sString) -> std::string;
WStringToString(const std::wstring& sString) -> std::string;
auto
WcharToUTF8(wchar_t c) -> std::string;
auto
RStringToWstring(const std::string& sString) -> std::wstring;
StringToWString(const std::string& sString) -> std::wstring;

struct LanguageInfo
{
Expand Down Expand Up @@ -769,9 +769,9 @@ auto
DirectoryIsEmpty(const std::string& sPath) -> bool;

auto
CompareRStringsAsc(const std::string& sStr1, const std::string& sStr2) -> bool;
CompareStringsAsc(const std::string& sStr1, const std::string& sStr2) -> bool;
void
SortRStringArray(std::vector<std::string>& asAddTo, bool bSortAscending = true);
SortStringArray(std::vector<std::string>& asAddTo, bool bSortAscending = true);

/* Find the mean and standard deviation of all numbers in [start,end). */
auto
Expand Down Expand Up @@ -977,7 +977,7 @@ FixSlashesInPlace(std::string& sPath);
void
CollapsePath(std::string& sPath, bool bRemoveLeadingDot = false);

/** @brief Utilities for converting the RStrings. */
/** @brief Utilities for converting the Strings. */
namespace StringConversion {
template<typename T>
auto
Expand Down
2 changes: 1 addition & 1 deletion src/RageUtil/Utils/RageUtil_CharConversions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ CodePageConvert(std::string& sText, int iCodePage)
iSize);
ASSERT(iSize != 0);

sText = WStringToRString(sOut);
sText = WStringToString(sOut);
return true;
}

Expand Down
Loading

0 comments on commit 19501c3

Please sign in to comment.