commit 850dcb1cb1bdf1242450831f4ca216a9f0944c68
parent db5316ac160b01973d5d43d576e0458bc9cf19e9
Author: Remy Noulin <loader2x@gmail.com>
Date: Sat, 17 Aug 2019 08:35:18 +0200
add O and o macros for calling object methods
completion.txt | 2 ++
documentation.md | 20 ++++++++++++++++++++
release/libsheepyObject.h | 20 ++++++++++++++++++++
src/libsheepyObject.h | 20 ++++++++++++++++++++
4 files changed, 62 insertions(+)
Diffstat:
4 files changed, 62 insertions(+), 0 deletions(-)
diff --git a/completion.txt b/completion.txt
@@ -1365,6 +1365,8 @@ finishG
void finishManyOF(void *paramType, ...)
finishManyO(paramType, ...)
finishManyG
+O(obj, method)
+o(obj, method, ...)
iter(obj, element)
iterLast(obj, element)
iterFrom(obj, index, element)
diff --git a/documentation.md b/documentation.md
@@ -14985,6 +14985,8 @@ finishG
void finishManyOF(void *paramType, ...)
finishManyO(paramType, ...)
finishManyG
+O(obj, method)
+o(obj, method, ...)
iter(obj, element)
iterLast(obj, element)
iterFrom(obj, index, element)
@@ -19099,6 +19101,24 @@ void finishManyOF(void *paramType, ...);
#define finishManyO(paramType, ...) finishManyOF(paramType, __VA_ARGS__, NULL)
#define finishManyG finishManyO
/*
+ * O calls an object method without parameters
+ * O(obj,toString) calls the toString method
+ * in the obj object
+ * The O macro simplies the creation of new classes
+ * inheriting from the base class removing the need
+ * to create macros to access the methods
+ */
+#define O(obj, method) (obj)->f->method(obj)
+/*
+ * o calls an object method with parameters
+ * o(obj,stringify,2) calls the stringify method
+ * in the obj smallJson object
+ * The o macro simplies the creation of new classes
+ * inheriting from the base class removing the need
+ * to create macros to access the methods
+ */
+#define o(obj, method, ...) (obj)->f->method(obj, __VA_ARGS__)
+/*
* iterators
* for arrays or dictionaries
*
diff --git a/release/libsheepyObject.h b/release/libsheepyObject.h
@@ -298,6 +298,26 @@ void finishManyOF(void *paramType, ...);
#define finishManyG finishManyO
/**
+ * O calls an object method without parameters
+ * O(obj,toString) calls the toString method
+ * in the obj object
+ * The O macro simplies the creation of new classes
+ * inheriting from the base class removing the need
+ * to create macros to access the methods
+ */
+#define O(obj, method) (obj)->f->method(obj)
+
+/**
+ * o calls an object method with parameters
+ * o(obj,stringify,2) calls the stringify method
+ * in the obj smallJson object
+ * The o macro simplies the creation of new classes
+ * inheriting from the base class removing the need
+ * to create macros to access the methods
+ */
+#define o(obj, method, ...) (obj)->f->method(obj, __VA_ARGS__)
+
+/**
* iterators
* for arrays or dictionaries
*
diff --git a/src/libsheepyObject.h b/src/libsheepyObject.h
@@ -298,6 +298,26 @@ void finishManyOF(void *paramType, ...);
#define finishManyG finishManyO
/**
+ * O calls an object method without parameters
+ * O(obj,toString) calls the toString method
+ * in the obj object
+ * The O macro simplies the creation of new classes
+ * inheriting from the base class removing the need
+ * to create macros to access the methods
+ */
+#define O(obj, method) (obj)->f->method(obj)
+
+/**
+ * o calls an object method with parameters
+ * o(obj,stringify,2) calls the stringify method
+ * in the obj smallJson object
+ * The o macro simplies the creation of new classes
+ * inheriting from the base class removing the need
+ * to create macros to access the methods
+ */
+#define o(obj, method, ...) (obj)->f->method(obj, __VA_ARGS__)
+
+/**
* iterators
* for arrays or dictionaries
*