Zen API

- Home
- Topics
- Types
- Files

All Classes Files Functions Variables Typedefs Friends Macros Modules Pages
kEvent.h
Go to the documentation of this file.
1
10 #ifndef K_API_EVENT_H
11 #define K_API_EVENT_H
12
13 #include <kApi/kApiDef.h>
14 #include <kApi/Utils/kEvent.x.h>
15
22 //typedef kObject kEvent; --forward-declared in kApiDef.x.h
23
32 kFx(kStatus) kEvent_Construct(kEvent* evnt, kAlloc allocator);
33
43 kFx(kStatus) kEvent_Add(kEvent evnt, kCallbackFx function, kPointer receiver);
44
54 kFx(kStatus) kEvent_Remove(kEvent evnt, kCallbackFx function, kPointer receiver);
55
63 kFx(kStatus) kEvent_Clear(kEvent evnt);
64
74 kFx(kStatus) kEvent_Notify(kEvent evnt, kPointer sender, void* args);
75
83 kInlineFx(kSize) kEvent_Count(kEvent evnt)
84 {
85 kObj(kEvent, evnt);
86
87 return kList_Count(obj->listeners);
88 }
89
100 kInlineFx(kList) kEvent_Listeners(kEvent evnt)
101 {
102 kObj(kEvent, evnt);
103
104 return obj->listeners;
105 }
106
107 #endif
kEvent::kEvent_Count
kSize kEvent_Count(kEvent evnt)
Count of event listeners.
Definition: kEvent.h:83
kPointer
Represents a void pointer.
kList::kList_Count
kSize kList_Count(kList list)
Returns the count of list elements.
Definition: kList.h:150
kSize
Represents an unsigned integer that can store a pointer address.
kAlloc
Abstract base class for memory allocator types.
kEvent
Represents a list of callbacks.
kInlineFx
#define kInlineFx(TYPE)
Inline method declaration helper.
Definition: kApiDef.h:26
kEvent::kEvent_Construct
kStatus kEvent_Construct(kEvent *evnt, kAlloc allocator)
Constructs a kEvent object.
kEvent::kEvent_Listeners
kList kEvent_Listeners(kEvent evnt)
Gets the internal list of event listeners.
Definition: kEvent.h:100
kObj
#define kObj(TypeName_T, T_object)
Declares a local "obj" (this-pointer) variable and initializes it from a type-checked object handle...
Definition: kApiDef.h:2923
kApiDef.h
Core Zen type declarations.
kEvent::kEvent_Clear
kStatus kEvent_Clear(kEvent evnt)
Removes all listeners from the event.
kCallbackFx
kStatus(kCall * kCallbackFx)(kPointer receiver, kPointer sender, void *args)
Callback signature for a generic event handler.
Definition: kApiDef.h:1737
kEvent::kEvent_Remove
kStatus kEvent_Remove(kEvent evnt, kCallbackFx function, kPointer receiver)
Removes a listener from the event.
kEvent::kEvent_Add
kStatus kEvent_Add(kEvent evnt, kCallbackFx function, kPointer receiver)
Adds a listener to the event.
kList
Represents a doubly-linked list.
kStatus
Represents an error code.
kEvent::kEvent_Notify
kStatus kEvent_Notify(kEvent evnt, kPointer sender, void *args)
Notifies all event listeners.