summaryrefslogtreecommitdiff
path: root/Source
diff options
context:
space:
mode:
authorLioncash <mathew1800@gmail.com>2017-03-21 17:22:28 -0400
committerLioncash <mathew1800@gmail.com>2017-03-21 18:03:02 -0400
commitf0fa692457495481b778f3cc86bde300cd22ef12 (patch)
tree0e0a0ed96f2d8934ec90b130edebb5a193a00ee7 /Source
parent3be53737683d03b7511a1207be8a0cd1cba57477 (diff)
GeckoCodeConfig: Move gecko code title building to its own function
Keeps it separate from the rest of the saving code and also allows for easy rvalue-reference moving into the lines vector as a side-benefit.
Diffstat (limited to 'Source')
-rw-r--r--Source/Core/Core/GeckoCodeConfig.cpp28
1 files changed, 13 insertions, 15 deletions
diff --git a/Source/Core/Core/GeckoCodeConfig.cpp b/Source/Core/Core/GeckoCodeConfig.cpp
index f50b848d68..712b186b65 100644
--- a/Source/Core/Core/GeckoCodeConfig.cpp
+++ b/Source/Core/Core/GeckoCodeConfig.cpp
@@ -97,6 +97,18 @@ std::vector<GeckoCode> LoadCodes(const IniFile& globalIni, const IniFile& localI
return gcodes;
}
+static std::string MakeGeckoCodeTitle(const GeckoCode& code)
+{
+ std::string title = '$' + code.name;
+
+ if (!code.creator.empty())
+ {
+ title += " [" + code.creator + ']';
+ }
+
+ return title;
+}
+
// used by the SaveGeckoCodes function
static void SaveGeckoCode(std::vector<std::string>& lines, std::vector<std::string>& enabledLines,
const GeckoCode& gcode)
@@ -107,21 +119,7 @@ static void SaveGeckoCode(std::vector<std::string>& lines, std::vector<std::stri
if (!gcode.user_defined)
return;
- std::string name;
-
- // save the name
- name += '$';
- name += gcode.name;
-
- // save the creator name
- if (gcode.creator.size())
- {
- name += " [";
- name += gcode.creator;
- name += ']';
- }
-
- lines.push_back(name);
+ lines.push_back(MakeGeckoCodeTitle(gcode));
// save all the code lines
for (const GeckoCode::Code& code : gcode.codes)