summaryrefslogtreecommitdiff
path: root/Source/Core/InputCommon/ControlReference/FunctionExpression.h
diff options
context:
space:
mode:
authorJordan Woyak <jordan.woyak@gmail.com>2019-01-26 12:17:30 -0600
committerJordan Woyak <jordan.woyak@gmail.com>2019-10-11 18:12:16 -0500
commitfd07ae8cec5c77ac60788350610739e6ac094547 (patch)
tree8f0dac16bcbc972f22f649f4d4c37eefa157f6d2 /Source/Core/InputCommon/ControlReference/FunctionExpression.h
parentd4f9b8c4efe9ce48aac5b43487c5d6c5d5fbd83b (diff)
ExpressionParser: Move FunctionExpression type definitions into another file.
Diffstat (limited to 'Source/Core/InputCommon/ControlReference/FunctionExpression.h')
-rw-r--r--Source/Core/InputCommon/ControlReference/FunctionExpression.h41
1 files changed, 41 insertions, 0 deletions
diff --git a/Source/Core/InputCommon/ControlReference/FunctionExpression.h b/Source/Core/InputCommon/ControlReference/FunctionExpression.h
new file mode 100644
index 0000000000..8ac7e9800c
--- /dev/null
+++ b/Source/Core/InputCommon/ControlReference/FunctionExpression.h
@@ -0,0 +1,41 @@
+// Copyright 2019 Dolphin Emulator Project
+// Licensed under GPLv2+
+// Refer to the license.txt file included.
+
+#pragma once
+
+#include <memory>
+#include <string>
+#include <vector>
+
+#include "InputCommon/ControlReference/ExpressionParser.h"
+#include "InputCommon/ControlReference/FunctionExpression.h"
+
+namespace ciface
+{
+namespace ExpressionParser
+{
+class FunctionExpression : public Expression
+{
+public:
+ int CountNumControls() const override;
+ void UpdateReferences(ControlEnvironment& env) override;
+ operator std::string() const override;
+
+ bool SetArguments(std::vector<std::unique_ptr<Expression>>&& args);
+
+protected:
+ virtual std::string GetFuncName() const = 0;
+ virtual bool ValidateArguments(const std::vector<std::unique_ptr<Expression>>& args) = 0;
+
+ Expression& GetArg(u32 number);
+ const Expression& GetArg(u32 number) const;
+
+private:
+ std::vector<std::unique_ptr<Expression>> m_args;
+};
+
+std::unique_ptr<FunctionExpression> MakeFunctionExpression(std::string name);
+
+} // namespace ExpressionParser
+} // namespace ciface