diff options
author | Not Zed <NotZed@Ximian.com> | 2004-11-04 13:34:05 +0800 |
---|---|---|
committer | Michael Zucci <zucchi@src.gnome.org> | 2004-11-04 13:34:05 +0800 |
commit | 0b736de5187a40f7e2c1414387cc8251e8d5ac9a (patch) | |
tree | 7daaedce122b86bda5dc333808c705e67e40c0f6 /camel/camel-object.h | |
parent | 584ff682e56b90d2a20dc77250ab691a525a2873 (diff) | |
download | gsoc2013-evolution-0b736de5187a40f7e2c1414387cc8251e8d5ac9a.tar.gz gsoc2013-evolution-0b736de5187a40f7e2c1414387cc8251e8d5ac9a.tar.zst gsoc2013-evolution-0b736de5187a40f7e2c1414387cc8251e8d5ac9a.zip |
check interfaces for events too. (camel_object_trigger_event): check
2004-11-02 Not Zed <NotZed@Ximian.com>
* camel-object.c (camel_object_hook_event): check interfaces for
events too.
(camel_object_trigger_event): check interfaces for events too.
(camel_object_class_add_event): more checks for interfaces vs
normal object classes.
(camel_object_class_add_interface): add an interface to a class.
(camel_object_get_interface): query for interfaces on an object.
(camel_object_get_type): register the interface type.
svn path=/trunk/; revision=27834
Diffstat (limited to 'camel/camel-object.h')
-rw-r--r-- | camel/camel-object.h | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/camel/camel-object.h b/camel/camel-object.h index 9ee9c45345..a1afdd71ca 100644 --- a/camel/camel-object.h +++ b/camel/camel-object.h @@ -72,6 +72,10 @@ typedef struct _CamelObject CamelObject; typedef unsigned int CamelObjectHookID; typedef struct _CamelObjectMeta CamelObjectMeta; +extern CamelType camel_interface_type; +#define CAMEL_INTERFACE_TYPE (camel_interface_type) +typedef struct _CamelInterface CamelInterface; + typedef void (*CamelObjectClassInitFunc) (CamelObjectClass *); typedef void (*CamelObjectClassFinalizeFunc) (CamelObjectClass *); typedef void (*CamelObjectInitFunc) (CamelObject *, CamelObjectClass *); @@ -165,6 +169,8 @@ struct _CamelObjectClass void (*init)(struct _CamelObject *, struct _CamelObjectClass *); void (*finalise)(struct _CamelObject *); + /* root-class fields follow, type system above */ + /* get/set interface */ int (*setv)(struct _CamelObject *, struct _CamelException *ex, CamelArgV *args); int (*getv)(struct _CamelObject *, struct _CamelException *ex, CamelArgGetV *args); @@ -180,6 +186,11 @@ struct _CamelObjectClass int (*state_write)(struct _CamelObject *, FILE *fp); }; +/* an interface is just a class with no instance data */ +struct _CamelInterface { + struct _CamelObjectClass type; +}; + /* The type system .... it's pretty simple..... */ void camel_type_init (void); CamelType camel_type_register(CamelType parent, const char * name, /*unsigned int ver, unsigned int rev,*/ @@ -190,6 +201,11 @@ CamelType camel_type_register(CamelType parent, const char * name, /*unsigned in CamelObjectInitFunc instance_init, CamelObjectFinalizeFunc instance_finalize); +CamelType camel_interface_register(CamelType parent, const char *name, + size_t classfuncs_size, + CamelObjectClassInitFunc class_init, + CamelObjectClassFinalizeFunc class_finalize); + /* deprecated interface */ #define camel_type_get_global_classfuncs(x) ((CamelObjectClass *)(x)) @@ -197,6 +213,7 @@ CamelType camel_type_register(CamelType parent, const char * name, /*unsigned in const char *camel_type_to_name (CamelType type); CamelType camel_name_to_type (const char *name); void camel_object_class_add_event (CamelObjectClass *klass, const char *name, CamelObjectEventPrepFunc prep); +void camel_object_class_add_interface(CamelObjectClass *klass, CamelType itype); void camel_object_class_dump_tree (CamelType root); @@ -207,6 +224,9 @@ gboolean camel_object_is(CamelObject *obj, CamelType ctype); CamelObjectClass *camel_object_class_cast (CamelObjectClass *klass, CamelType ctype); gboolean camel_object_class_is (CamelObjectClass *klass, CamelType ctype); +CamelObjectClass *camel_interface_cast(CamelObjectClass *klass, CamelType ctype); +gboolean camel_interface_is(CamelObjectClass *k, CamelType ctype); + CamelType camel_object_get_type (void); CamelObject *camel_object_new (CamelType type); @@ -226,6 +246,9 @@ void camel_object_remove_event(void *obj, CamelObjectHookID id); void camel_object_unhook_event(void *obj, const char *name, CamelObjectEventHookFunc hook, void *data); void camel_object_trigger_event(void *obj, const char *name, void *event_data); +/* interfaces */ +void *camel_object_get_interface(void *vo, CamelType itype); + /* get/set methods */ int camel_object_set(void *obj, struct _CamelException *ex, ...); int camel_object_setv(void *obj, struct _CamelException *ex, CamelArgV *); |