ExpressionParser: Add support for literals.

This commit is contained in:
Jordan Woyak
2018-12-30 10:37:23 -06:00
parent 5be061e27f
commit f3192ca06d
2 changed files with 76 additions and 21 deletions

View File

@ -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