Misc: Remove StringUtil::{Starts,Ends}With, use C++20
This commit is contained in:
@ -324,7 +324,7 @@ std::vector<std::pair<std::string, std::string>> SDLInputSource::EnumerateDevice
|
||||
std::optional<InputBindingKey> SDLInputSource::ParseKeyString(const std::string_view& device,
|
||||
const std::string_view& binding)
|
||||
{
|
||||
if (!StringUtil::StartsWith(device, "SDL-") || binding.empty())
|
||||
if (!device.starts_with("SDL-") || binding.empty())
|
||||
return std::nullopt;
|
||||
|
||||
const std::optional<s32> player_id = StringUtil::FromChars<s32>(device.substr(4));
|
||||
@ -335,7 +335,7 @@ std::optional<InputBindingKey> SDLInputSource::ParseKeyString(const std::string_
|
||||
key.source_type = InputSourceType::SDL;
|
||||
key.source_index = static_cast<u32>(player_id.value());
|
||||
|
||||
if (StringUtil::EndsWith(binding, "Motor"))
|
||||
if (binding.ends_with("Motor"))
|
||||
{
|
||||
key.source_subtype = InputSubclass::ControllerMotor;
|
||||
if (binding == "LargeMotor")
|
||||
@ -353,7 +353,7 @@ std::optional<InputBindingKey> SDLInputSource::ParseKeyString(const std::string_
|
||||
return std::nullopt;
|
||||
}
|
||||
}
|
||||
else if (StringUtil::EndsWith(binding, "Haptic"))
|
||||
else if (binding.ends_with("Haptic"))
|
||||
{
|
||||
key.source_subtype = InputSubclass::ControllerHaptic;
|
||||
key.data = 0;
|
||||
@ -364,7 +364,7 @@ std::optional<InputBindingKey> SDLInputSource::ParseKeyString(const std::string_
|
||||
// likely an axis
|
||||
const std::string_view axis_name(binding.substr(1));
|
||||
|
||||
if (StringUtil::StartsWith(axis_name, "Axis"))
|
||||
if (axis_name.starts_with("Axis"))
|
||||
{
|
||||
std::string_view end;
|
||||
if (auto value = StringUtil::FromChars<u32>(axis_name.substr(4), 10, &end))
|
||||
@ -388,7 +388,7 @@ std::optional<InputBindingKey> SDLInputSource::ParseKeyString(const std::string_
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (StringUtil::StartsWith(binding, "FullAxis"))
|
||||
else if (binding.starts_with("FullAxis"))
|
||||
{
|
||||
std::string_view end;
|
||||
if (auto value = StringUtil::FromChars<u32>(binding.substr(8), 10, &end))
|
||||
@ -400,7 +400,7 @@ std::optional<InputBindingKey> SDLInputSource::ParseKeyString(const std::string_
|
||||
return key;
|
||||
}
|
||||
}
|
||||
else if (StringUtil::StartsWith(binding, "Hat"))
|
||||
else if (binding.starts_with("Hat"))
|
||||
{
|
||||
std::string_view hat_dir;
|
||||
if (auto value = StringUtil::FromChars<u32>(binding.substr(3), 10, &hat_dir); value.has_value() && !hat_dir.empty())
|
||||
@ -419,7 +419,7 @@ std::optional<InputBindingKey> SDLInputSource::ParseKeyString(const std::string_
|
||||
else
|
||||
{
|
||||
// must be a button
|
||||
if (StringUtil::StartsWith(binding, "Button"))
|
||||
if (binding.starts_with("Button"))
|
||||
{
|
||||
if (auto value = StringUtil::FromChars<u32>(binding.substr(6)))
|
||||
{
|
||||
@ -584,7 +584,7 @@ bool SDLInputSource::ProcessSDLEvent(const SDL_Event* event)
|
||||
|
||||
SDL_Joystick* SDLInputSource::GetJoystickForDevice(const std::string_view& device)
|
||||
{
|
||||
if (!StringUtil::StartsWith(device, "SDL-"))
|
||||
if (!device.starts_with("SDL-"))
|
||||
return nullptr;
|
||||
|
||||
const std::optional<s32> player_id = StringUtil::FromChars<s32>(device.substr(4));
|
||||
@ -893,7 +893,7 @@ std::vector<InputBindingKey> SDLInputSource::EnumerateMotors()
|
||||
|
||||
bool SDLInputSource::GetGenericBindingMapping(const std::string_view& device, GenericInputBindingMapping* mapping)
|
||||
{
|
||||
if (!StringUtil::StartsWith(device, "SDL-"))
|
||||
if (!device.starts_with("SDL-"))
|
||||
return false;
|
||||
|
||||
const std::optional<s32> player_id = StringUtil::FromChars<s32>(device.substr(4));
|
||||
|
||||
Reference in New Issue
Block a user