diff options
| author | Matthew Parlane <parlane@gmail.com> | 2013-08-16 19:17:07 +1200 |
|---|---|---|
| committer | Matthew Parlane <parlane@gmail.com> | 2013-08-16 19:17:07 +1200 |
| commit | 9de7611ff940d24551bc77a5e29b86911e3fa749 (patch) | |
| tree | 7615ec4cfd3aaba63d96ef1cb3cc33fd0efa516a /Source/Core/InputCommon/Src/ControllerInterface/ExpressionParser.h | |
| parent | 417552b21e30aee3dc2b720d65c2cd757997a33e (diff) | |
| parent | bff2bc1288fa4309e1b2aef1486845ba01311100 (diff) | |
Merge branch 'master' into wii-network
Conflicts:
CMakeLists.txt
Source/Core/Core/Core.vcxproj
Source/Core/DolphinWX/Dolphin.vcxproj
Source/Core/DolphinWX/Dolphin.vcxproj.filters
Source/Dolphin_2010.sln
Source/VSProps/Dolphin.Win32.props
Source/VSProps/Dolphin.x64.props
Diffstat (limited to 'Source/Core/InputCommon/Src/ControllerInterface/ExpressionParser.h')
| -rw-r--r-- | Source/Core/InputCommon/Src/ControllerInterface/ExpressionParser.h | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/Source/Core/InputCommon/Src/ControllerInterface/ExpressionParser.h b/Source/Core/InputCommon/Src/ControllerInterface/ExpressionParser.h new file mode 100644 index 0000000000..70cc51373b --- /dev/null +++ b/Source/Core/InputCommon/Src/ControllerInterface/ExpressionParser.h @@ -0,0 +1,69 @@ + +#ifndef _EXPRESSIONPARSER_H_ +#define _EXPRESSIONPARSER_H_ + +#include <string> +#include "Device.h" + +namespace ciface +{ +namespace ExpressionParser +{ + +class ControlQualifier +{ +public: + bool has_device; + Core::DeviceQualifier device_qualifier; + std::string control_name; + + ControlQualifier() : has_device(false) {} + + operator std::string() + { + if (has_device) + return device_qualifier.ToString() + ":" + control_name; + else + return control_name; + } +}; + +class ControlFinder +{ +public: + ControlFinder(const Core::DeviceContainer &container_, const Core::DeviceQualifier &default_, const bool is_input_) : container(container_), default_device(default_), is_input(is_input_) {} + Core::Device::Control *FindControl(ControlQualifier qualifier); + +private: + Core::Device *FindDevice(ControlQualifier qualifier); + const Core::DeviceContainer &container; + const Core::DeviceQualifier &default_device; + bool is_input; +}; + +class ExpressionNode; +class Expression +{ +public: + Expression() : node(NULL) {} + Expression(ExpressionNode *node); + ~Expression(); + ControlState GetValue(); + void SetValue (ControlState state); + int num_controls; + ExpressionNode *node; +}; + +enum ExpressionParseStatus +{ + EXPRESSION_PARSE_SUCCESS = 0, + EXPRESSION_PARSE_SYNTAX_ERROR, + EXPRESSION_PARSE_NO_DEVICE, +}; + +ExpressionParseStatus ParseExpression(std::string expr, ControlFinder &finder, Expression **expr_out); + +} +} + +#endif |
