From 492d5b6ac7294ae183d47493b144ca0b3b4a7c2c Mon Sep 17 00:00:00 2001 From: Michael Maltese Date: Fri, 9 Dec 2016 13:19:23 -0800 Subject: [PATCH] ControlReference: hide parse_error behind GetParseStatus() --- Source/Core/DolphinWX/Input/InputConfigDiag.cpp | 6 +++--- .../InputCommon/ControlReference/ControlReference.cpp | 8 +++++++- .../Core/InputCommon/ControlReference/ControlReference.h | 3 ++- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/Source/Core/DolphinWX/Input/InputConfigDiag.cpp b/Source/Core/DolphinWX/Input/InputConfigDiag.cpp index 0d64f81ee4..af218ff470 100644 --- a/Source/Core/DolphinWX/Input/InputConfigDiag.cpp +++ b/Source/Core/DolphinWX/Input/InputConfigDiag.cpp @@ -326,7 +326,7 @@ void ControlDialog::UpdateGUI() m_bound_label->SetLabel( wxString::Format(_("Bound Controls: %lu"), (unsigned long)control_reference->BoundCount())); - switch (control_reference->parse_error) + switch (control_reference->GetParseStatus()) { case EXPRESSION_PARSE_SYNTAX_ERROR: m_error_label->SetLabel(_("Syntax error")); @@ -391,8 +391,8 @@ bool ControlDialog::Validate() UpdateGUI(); - return (control_reference->parse_error == EXPRESSION_PARSE_SUCCESS || - control_reference->parse_error == EXPRESSION_PARSE_NO_DEVICE); + return (control_reference->GetParseStatus() == EXPRESSION_PARSE_SUCCESS || + control_reference->GetParseStatus() == EXPRESSION_PARSE_NO_DEVICE); } void InputConfigDialog::SetDevice(wxCommandEvent&) diff --git a/Source/Core/InputCommon/ControlReference/ControlReference.cpp b/Source/Core/InputCommon/ControlReference/ControlReference.cpp index 5dc8c858ed..1d3d62e8c3 100644 --- a/Source/Core/InputCommon/ControlReference/ControlReference.cpp +++ b/Source/Core/InputCommon/ControlReference/ControlReference.cpp @@ -33,13 +33,14 @@ void ControlReference::UpdateReference(ciface::Core::DeviceContainer& devices, parsed_expression = nullptr; ControlFinder finder(devices, default_device, IsInput()); - parse_error = ParseExpression(expression, finder, &parsed_expression); + m_parse_status = ParseExpression(expression, finder, &parsed_expression); } ControlReference::~ControlReference() { delete parsed_expression; } + int ControlReference::BoundCount() const { if (parsed_expression) @@ -48,6 +49,11 @@ int ControlReference::BoundCount() const return 0; } +ExpressionParseStatus ControlReference::GetParseStatus() const +{ + return m_parse_status; +} + ControlReference::ControlReference() : range(1), parsed_expression(nullptr) { } diff --git a/Source/Core/InputCommon/ControlReference/ControlReference.h b/Source/Core/InputCommon/ControlReference/ControlReference.h index 4448b58701..49f08b97ce 100644 --- a/Source/Core/InputCommon/ControlReference/ControlReference.h +++ b/Source/Core/InputCommon/ControlReference/ControlReference.h @@ -29,16 +29,17 @@ public: virtual bool IsInput() const = 0; int BoundCount() const; + ciface::ExpressionParser::ExpressionParseStatus GetParseStatus() const; void UpdateReference(ciface::Core::DeviceContainer& devices, const ciface::Core::DeviceQualifier& default_device); ControlState range; std::string expression; - ciface::ExpressionParser::ExpressionParseStatus parse_error; protected: ControlReference(); ciface::ExpressionParser::Expression* parsed_expression; + ciface::ExpressionParser::ExpressionParseStatus m_parse_status; }; //