summaryrefslogtreecommitdiffstats
path: root/CheckItem.c
diff options
context:
space:
mode:
authorHisham Muhammad <hisham@gobolinux.org>2012-12-05 15:12:20 +0000
committerHisham Muhammad <hisham@gobolinux.org>2012-12-05 15:12:20 +0000
commit00b324bfc162030b575e03795dcfcaac56bd0b4d (patch)
treefbaada243839b0b67351856e2d02a2e8184bf65f /CheckItem.c
parent2a73405cd060b543d56987650327b18078a137d7 (diff)
Changes in object model: separate class objects to store vtable. Also, nicer UTF-8 display of big numbers.
Diffstat (limited to 'CheckItem.c')
-rw-r--r--CheckItem.c16
1 files changed, 6 insertions, 10 deletions
diff --git a/CheckItem.c b/CheckItem.c
index 0fb40cfd..8c05e38e 100644
--- a/CheckItem.c
+++ b/CheckItem.c
@@ -24,12 +24,6 @@ typedef struct CheckItem_ {
}*/
-#ifdef DEBUG
-char* CHECKITEM_CLASS = "CheckItem";
-#else
-#define CHECKITEM_CLASS NULL
-#endif
-
static void CheckItem_delete(Object* cast) {
CheckItem* this = (CheckItem*)cast;
assert (this != NULL);
@@ -50,11 +44,13 @@ static void CheckItem_display(Object* cast, RichString* out) {
RichString_append(out, CRT_colors[CHECK_TEXT], this->text);
}
+ObjectClass CheckItem_class = {
+ .display = CheckItem_display,
+ .delete = CheckItem_delete
+};
+
CheckItem* CheckItem_new(char* text, bool* ref, bool value) {
- CheckItem* this = malloc(sizeof(CheckItem));
- Object_setClass(this, CHECKITEM_CLASS);
- ((Object*)this)->display = CheckItem_display;
- ((Object*)this)->delete = CheckItem_delete;
+ CheckItem* this = AllocThis(CheckItem);
this->text = text;
this->value = value;
this->ref = ref;

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