summaryrefslogtreecommitdiff
path: root/src/core/common/Function.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/common/Function.hpp')
-rw-r--r--src/core/common/Function.hpp23
1 files changed, 20 insertions, 3 deletions
diff --git a/src/core/common/Function.hpp b/src/core/common/Function.hpp
index 04030c8..79ee6b9 100644
--- a/src/core/common/Function.hpp
+++ b/src/core/common/Function.hpp
@@ -42,7 +42,7 @@ namespace ousia {
*/
class Function {
protected:
- Function() {};
+ Function(){};
public:
Function(const Function &) = delete;
@@ -62,6 +62,23 @@ public:
};
/**
+ * Function doing nothing. Instances of this class are used as default values
+ * for instances of the Function class.
+ */
+class FunctionStub : public Function {
+public:
+ /**
+ * Constructor of the FunctionStub class.
+ */
+ FunctionStub() {}
+
+ Variant call(const Variant::arrayType &, void *) const override
+ {
+ return nullptr;
+ }
+};
+
+/**
* The Method class refers to a method in the C++ code, belonging to an object
* of a certain type T.
*
@@ -93,7 +110,7 @@ public:
*
* @param method is a pointer at the C++ function that should be called.
*/
- Method(Callback method) : method(method) {};
+ Method(Callback method) : method(method){};
/**
* Calls the underlying method.
@@ -106,7 +123,7 @@ public:
void *thisRef = nullptr) const override
{
// Call the method
- return method(args, static_cast<T*>(thisRef));
+ return method(args, static_cast<T *>(thisRef));
}
};
}