diff options
| author | Jordan Woyak <jordan.woyak@gmail.com> | 2018-12-30 10:37:23 -0600 |
|---|---|---|
| committer | Jordan Woyak <jordan.woyak@gmail.com> | 2019-10-11 17:13:58 -0500 |
| commit | f3192ca06de1007545bf6c3a49ddc83fb615a642 (patch) | |
| tree | 8481a3337718e143a64a9851ef4bd4b3a7eb0638 /Source/Core/InputCommon/ControlReference/ExpressionParser.h | |
| parent | 5be061e27f7853b744f233ba8f7df22acb69888b (diff) | |
ExpressionParser: Add support for literals.
Diffstat (limited to 'Source/Core/InputCommon/ControlReference/ExpressionParser.h')
| -rw-r--r-- | Source/Core/InputCommon/ControlReference/ExpressionParser.h | 18 |
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 |
