summaryrefslogtreecommitdiffstats
path: root/Object.h
diff options
context:
space:
mode:
authorChristian Göttsche <cgzones@googlemail.com>2020-10-06 12:28:11 +0200
committercgzones <cgzones@googlemail.com>2020-10-10 11:25:19 +0200
commit79ad39c718bfb2973d610c2d039a5024354e602f (patch)
treeefac0bfaf60cc44a5a2b2a8c8db251cbacf5ebab /Object.h
parente5fdb80c7d13d836ec244390976741dd99bc6535 (diff)
Mark Object pointer to _display function const
Diffstat (limited to 'Object.h')
-rw-r--r--Object.h8
1 files changed, 4 insertions, 4 deletions
diff --git a/Object.h b/Object.h
index 0d0e0036..36ab2544 100644
--- a/Object.h
+++ b/Object.h
@@ -14,16 +14,16 @@ in the source distribution for its full text.
typedef struct Object_ Object;
-typedef void(*Object_Display)(Object*, RichString*);
+typedef void(*Object_Display)(const Object*, RichString*);
typedef long(*Object_Compare)(const void*, const void*);
typedef void(*Object_Delete)(Object*);
-#define Object_getClass(obj_) ((Object*)(obj_))->klass
-#define Object_setClass(obj_, class_) Object_getClass(obj_) = (const ObjectClass*) class_
+#define Object_getClass(obj_) ((const Object*)(obj_))->klass
+#define Object_setClass(obj_, class_) (((Object*)(obj_))->klass = (const ObjectClass*) class_)
#define Object_delete(obj_) Object_getClass(obj_)->delete((Object*)(obj_))
#define Object_displayFn(obj_) Object_getClass(obj_)->display
-#define Object_display(obj_, str_) Object_getClass(obj_)->display((Object*)(obj_), str_)
+#define Object_display(obj_, str_) Object_getClass(obj_)->display((const Object*)(obj_), str_)
#define Object_compare(obj_, other_) Object_getClass(obj_)->compare((const void*)(obj_), other_)
#define Class(class_) ((const ObjectClass*)(&(class_ ## _class)))

© 2014-2024 Faster IT GmbH | imprint | privacy policy