summaryrefslogtreecommitdiff
path: root/Source/Core/InputCommon
diff options
context:
space:
mode:
authorLioncash <mathew1800@gmail.com>2017-06-03 19:32:46 -0400
committerLioncash <mathew1800@gmail.com>2017-06-03 19:34:35 -0400
commit5862d1fc41efd8011fb776e32ef11e6ed2ec0a49 (patch)
tree03e4cf10422d5913fe3205a83ae522668abda985 /Source/Core/InputCommon
parent4b53093acbbbf060ac12186aacf9d0f157965e1b (diff)
Device: Provide operator!= counterparts to operator== for DeviceQualifier
Makes comparison logic symmetric
Diffstat (limited to 'Source/Core/InputCommon')
-rw-r--r--Source/Core/InputCommon/ControllerInterface/Device.cpp10
-rw-r--r--Source/Core/InputCommon/ControllerInterface/Device.h6
2 files changed, 15 insertions, 1 deletions
diff --git a/Source/Core/InputCommon/ControllerInterface/Device.cpp b/Source/Core/InputCommon/ControllerInterface/Device.cpp
index 930352a908..f83dae268e 100644
--- a/Source/Core/InputCommon/ControllerInterface/Device.cpp
+++ b/Source/Core/InputCommon/ControllerInterface/Device.cpp
@@ -120,11 +120,21 @@ bool DeviceQualifier::operator==(const Device* const dev) const
return false;
}
+bool DeviceQualifier::operator!=(const Device* const dev) const
+{
+ return !operator==(dev);
+}
+
bool DeviceQualifier::operator==(const DeviceQualifier& devq) const
{
return std::tie(cid, name, source) == std::tie(devq.cid, devq.name, devq.source);
}
+bool DeviceQualifier::operator!=(const DeviceQualifier& devq) const
+{
+ return !operator==(devq);
+}
+
std::shared_ptr<Device> DeviceContainer::FindDevice(const DeviceQualifier& devq) const
{
std::lock_guard<std::mutex> lk(m_devices_mutex);
diff --git a/Source/Core/InputCommon/ControllerInterface/Device.h b/Source/Core/InputCommon/ControllerInterface/Device.h
index bda6f1fb0a..7b601cc775 100644
--- a/Source/Core/InputCommon/ControllerInterface/Device.h
+++ b/Source/Core/InputCommon/ControllerInterface/Device.h
@@ -136,8 +136,12 @@ public:
void FromDevice(const Device* const dev);
void FromString(const std::string& str);
std::string ToString() const;
+
bool operator==(const DeviceQualifier& devq) const;
- bool operator==(const Device* const dev) const;
+ bool operator!=(const DeviceQualifier& devq) const;
+
+ bool operator==(const Device* dev) const;
+ bool operator!=(const Device* dev) const;
std::string source;
int cid;