diff options
| author | mitaclaw <140017135+mitaclaw@users.noreply.github.com> | 2024-09-22 00:24:21 -0700 |
|---|---|---|
| committer | mitaclaw <140017135+mitaclaw@users.noreply.github.com> | 2024-09-22 21:09:36 -0700 |
| commit | 5f906736863f35a7018aaa11a7cac408229c21cf (patch) | |
| tree | 5449078c9489852efa511803cd06e3e8bc5c7728 /Source/Core/InputCommon | |
| parent | de67c4c93bd15846f68df4006dd2c93fba5720d2 (diff) | |
StringUtil: Remove `JoinStrings`
With 12 uses of `JoinStrings` in the codebase vs 36 uses of `fmt::join`, fmtlib's range adapter for string concatenation with delimiters is clearly the preferred option.
Diffstat (limited to 'Source/Core/InputCommon')
| -rw-r--r-- | Source/Core/InputCommon/ControllerEmu/StickGate.cpp | 3 | ||||
| -rw-r--r-- | Source/Core/InputCommon/ControllerInterface/MappingCommon.cpp | 7 |
2 files changed, 6 insertions, 4 deletions
diff --git a/Source/Core/InputCommon/ControllerEmu/StickGate.cpp b/Source/Core/InputCommon/ControllerEmu/StickGate.cpp index 4cdf3b63fb..4edc07fd02 100644 --- a/Source/Core/InputCommon/ControllerEmu/StickGate.cpp +++ b/Source/Core/InputCommon/ControllerEmu/StickGate.cpp @@ -7,6 +7,7 @@ #include <cmath> #include <fmt/format.h> +#include <fmt/ranges.h> #include "Common/Common.h" #include "Common/MathUtil.h" @@ -287,7 +288,7 @@ void ReshapableInput::SaveConfig(Common::IniFile::Section* section, std::transform( m_calibration.begin(), m_calibration.end(), save_data.begin(), [](ControlState val) { return fmt::format("{:.2f}", val * CALIBRATION_CONFIG_SCALE); }); - section->Set(group + CALIBRATION_CONFIG_NAME, JoinStrings(save_data, " "), ""); + section->Set(group + CALIBRATION_CONFIG_NAME, fmt::to_string(fmt::join(save_data, " ")), ""); // Save center value. static constexpr char center_format[] = "{:.2f} {:.2f}"; diff --git a/Source/Core/InputCommon/ControllerInterface/MappingCommon.cpp b/Source/Core/InputCommon/ControllerInterface/MappingCommon.cpp index 56bab1a981..4acee6a970 100644 --- a/Source/Core/InputCommon/ControllerInterface/MappingCommon.cpp +++ b/Source/Core/InputCommon/ControllerInterface/MappingCommon.cpp @@ -9,6 +9,7 @@ #include <vector> #include <fmt/format.h> +#include <fmt/ranges.h> #include "Common/StringUtil.h" #include "InputCommon/ControllerInterface/CoreDevice.h" @@ -96,12 +97,12 @@ BuildExpression(const std::vector<ciface::Core::DeviceContainer::InputDetection> if (is_hotkey) { - alternations.push_back(fmt::format("@({})", JoinStrings(alternation, "+"))); + alternations.push_back(fmt::format("@({})", fmt::join(alternation, "+"))); } else { std::sort(alternation.begin(), alternation.end()); - alternations.push_back(JoinStrings(alternation, "&")); + alternations.push_back(fmt::to_string(fmt::join(alternation, "&"))); } }; @@ -130,7 +131,7 @@ BuildExpression(const std::vector<ciface::Core::DeviceContainer::InputDetection> std::sort(alternations.begin(), alternations.end()); alternations.erase(std::unique(alternations.begin(), alternations.end()), alternations.end()); - return JoinStrings(alternations, "|"); + return fmt::to_string(fmt::join(alternations, "|")); } void RemoveSpuriousTriggerCombinations( |
