summaryrefslogtreecommitdiff
path: root/Source/Core/InputCommon/ControlReference/ExpressionParser.h
diff options
context:
space:
mode:
Diffstat (limited to 'Source/Core/InputCommon/ControlReference/ExpressionParser.h')
-rw-r--r--Source/Core/InputCommon/ControlReference/ExpressionParser.h18
1 files changed, 18 insertions, 0 deletions
diff --git a/Source/Core/InputCommon/ControlReference/ExpressionParser.h b/Source/Core/InputCommon/ControlReference/ExpressionParser.h
index 56c0340f49..0a42d90c62 100644
--- a/Source/Core/InputCommon/ControlReference/ExpressionParser.h
+++ b/Source/Core/InputCommon/ControlReference/ExpressionParser.h
@@ -19,6 +19,7 @@ public:
std::string control_name;
ControlQualifier() : has_device(false) {}
+
operator std::string() const
{
if (has_device)
@@ -26,6 +27,23 @@ public:
else
return control_name;
}
+
+ void FromString(const std::string& str)
+ {
+ const auto col_pos = str.find_last_of(':');
+
+ has_device = (str.npos != col_pos);
+ if (has_device)
+ {
+ device_qualifier.FromString(str.substr(0, col_pos));
+ control_name = str.substr(col_pos + 1);
+ }
+ else
+ {
+ device_qualifier.FromString("");
+ control_name = str;
+ }
+ }
};
class ControlFinder