From e8edc49bbec053e3ee08f6ffc8be39935c6fa6d1 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Fri, 22 Nov 2019 14:10:28 -0500 Subject: InputCommon: Make use of fmt where applicable Continues the migration over to fmt --- Source/Core/InputCommon/ControllerInterface/Device.cpp | 5 +++-- Source/Core/InputCommon/ControllerInterface/Xlib/XInput2.cpp | 8 +++++--- 2 files changed, 8 insertions(+), 5 deletions(-) (limited to 'Source/Core/InputCommon/ControllerInterface') diff --git a/Source/Core/InputCommon/ControllerInterface/Device.cpp b/Source/Core/InputCommon/ControllerInterface/Device.cpp index 5b0fa7ebd1..d91a9e119e 100644 --- a/Source/Core/InputCommon/ControllerInterface/Device.cpp +++ b/Source/Core/InputCommon/ControllerInterface/Device.cpp @@ -11,7 +11,8 @@ #include #include -#include "Common/StringUtil.h" +#include + #include "Common/Thread.h" namespace ciface::Core @@ -47,7 +48,7 @@ void Device::AddOutput(Device::Output* const o) std::string Device::GetQualifiedName() const { - return StringFromFormat("%s/%i/%s", this->GetSource().c_str(), GetId(), this->GetName().c_str()); + return fmt::format("{}/{}/{}", GetSource(), GetId(), GetName()); } Device::Input* Device::FindInput(std::string_view name) const diff --git a/Source/Core/InputCommon/ControllerInterface/Xlib/XInput2.cpp b/Source/Core/InputCommon/ControllerInterface/Xlib/XInput2.cpp index 30f10c8537..d9642c6264 100644 --- a/Source/Core/InputCommon/ControllerInterface/Xlib/XInput2.cpp +++ b/Source/Core/InputCommon/ControllerInterface/Xlib/XInput2.cpp @@ -10,6 +10,8 @@ #include #include +#include + #include "InputCommon/ControllerInterface/Xlib/XInput2.h" #include "Common/StringUtil.h" @@ -338,7 +340,7 @@ ControlState KeyboardMouse::Key::GetState() const KeyboardMouse::Button::Button(unsigned int index, unsigned int* buttons) : m_buttons(buttons), m_index(index) { - name = StringFromFormat("Click %d", m_index + 1); + name = fmt::format("Click {}", m_index + 1); } ControlState KeyboardMouse::Button::GetState() const @@ -349,7 +351,7 @@ ControlState KeyboardMouse::Button::GetState() const KeyboardMouse::Cursor::Cursor(u8 index, bool positive, const float* cursor) : m_cursor(cursor), m_index(index), m_positive(positive) { - name = std::string("Cursor ") + (char)('X' + m_index) + (m_positive ? '+' : '-'); + name = fmt::format("Cursor {}{}", static_cast('X' + m_index), (m_positive ? '+' : '-')); } ControlState KeyboardMouse::Cursor::GetState() const @@ -360,7 +362,7 @@ ControlState KeyboardMouse::Cursor::GetState() const KeyboardMouse::Axis::Axis(u8 index, bool positive, const float* axis) : m_axis(axis), m_index(index), m_positive(positive) { - name = std::string("Axis ") + (char)('X' + m_index) + (m_positive ? '+' : '-'); + name = fmt::format("Axis {}{}", static_cast('X' + m_index), (m_positive ? '+' : '-')); } ControlState KeyboardMouse::Axis::GetState() const -- cgit v1.2.3