summaryrefslogtreecommitdiff
path: root/src/base.cpp
diff options
context:
space:
mode:
authorEmiel Bruijntjes <emiel.bruijntjes@copernica.com>2014-03-11 16:03:55 +0100
committerEmiel Bruijntjes <emiel.bruijntjes@copernica.com>2014-03-11 16:03:55 +0100
commit849c1c4cd7901213e54af954646a80137ad95619 (patch)
tree5e1c47c3337b15d866da00426a5e548564f55b45 /src/base.cpp
parent75321da61984251d6f5ab97f57efb2050f4dadf2 (diff)
implemented __invoke method
Diffstat (limited to 'src/base.cpp')
-rw-r--r--src/base.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/base.cpp b/src/base.cpp
index 85cb85c..a5dc7b3 100644
--- a/src/base.cpp
+++ b/src/base.cpp
@@ -165,6 +165,25 @@ Value Base::__call(const char *method, Parameters &params)
}
/**
+ * Call the class as if it was a function
+ *
+ * This method is called when a an object is used with () operators:
+ * $object(). You can override this method to make objects callable.
+ *
+ * @param params The parameters that were passed to the function
+ * @return Value The return value
+ */
+Value Base::__invoke(Parameters &params)
+{
+ // throw an exception that will be caught in the ClassBase class,
+ // so that the default implementation of the function can be called
+ throw NotImplemented();
+
+ // unreachable code
+ return nullptr;
+}
+
+/**
* End namespace
*/
}