mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-01-10 08:09:26 +01:00
InputCommon: Return error, if any, from ControlReference::SetExpression().
This commit is contained in:
parent
3cd4c56645
commit
cae741584b
@ -50,12 +50,13 @@ std::string ControlReference::GetExpression() const
|
|||||||
return m_expression;
|
return m_expression;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ControlReference::SetExpression(std::string expr)
|
std::optional<std::string> ControlReference::SetExpression(std::string expr)
|
||||||
{
|
{
|
||||||
m_expression = std::move(expr);
|
m_expression = std::move(expr);
|
||||||
auto parse_result = ParseExpression(m_expression);
|
auto parse_result = ParseExpression(m_expression);
|
||||||
m_parse_status = parse_result.status;
|
m_parse_status = parse_result.status;
|
||||||
m_parsed_expression = std::move(parse_result.expr);
|
m_parsed_expression = std::move(parse_result.expr);
|
||||||
|
return parse_result.description;
|
||||||
}
|
}
|
||||||
|
|
||||||
ControlReference::ControlReference() : range(1), m_parsed_expression(nullptr)
|
ControlReference::ControlReference() : range(1), m_parsed_expression(nullptr)
|
||||||
|
@ -38,7 +38,9 @@ public:
|
|||||||
ciface::ExpressionParser::ParseStatus GetParseStatus() const;
|
ciface::ExpressionParser::ParseStatus GetParseStatus() const;
|
||||||
void UpdateReference(ciface::ExpressionParser::ControlEnvironment& env);
|
void UpdateReference(ciface::ExpressionParser::ControlEnvironment& env);
|
||||||
std::string GetExpression() const;
|
std::string GetExpression() const;
|
||||||
void SetExpression(std::string expr);
|
|
||||||
|
// Returns a human-readable error description when the given expression is invalid.
|
||||||
|
std::optional<std::string> SetExpression(std::string expr);
|
||||||
|
|
||||||
ControlState range;
|
ControlState range;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user