Zen API

- Home
- Topics
- Types
- Files

All Classes Files Functions Variables Typedefs Friends Macros Modules Pages
kBox.h
Go to the documentation of this file.
1
10 #ifndef K_API_BOX_H
11 #define K_API_BOX_H
12
13 #include <kApi/kApiDef.h>
14 #include <kApi/Data/kBox.x.h>
15
30 //typedef kObject kBox; --forward-declared in kApiDef.x.h
31
41 kFx(kStatus) kBox_Construct(kBox* box, kType itemType, kAlloc allocator);
42
51 kFx(kStatus) kBox_Allocate(kBox box, kType itemType);
52
61 kFx(kStatus) kBox_Assign(kBox box, kBox source);
62
70 kFx(kStatus) kBox_Zero(kBox box);
71
80 kFx(kStatus) kBox_SetItem(kBox box, const void* item);
81
93 #define kBox_SetItemT(kBox_box, TPtr_item) \
94 xkBox_SetItemT(kBox_box, TPtr_item, sizeof(*TPtr_item))
95
104 kFx(kStatus) kBox_Item(kBox box, void* item);
105
117 #define kBox_SetAsT(kBox_box, T_value, T) \
118 (kPointer_WriteAs(xkBox_AsT(kBox_box, sizeof(T)), T_value, T), (void)0)
119
130 #define kBox_AsT(kBox_box, T) \
131 kPointer_ReadAs(xkBox_AsT(kBox_box, sizeof(T)), T)
132
144 #define kBox_ItemT(kBox_box, TPtr_item) \
145 xkBox_ItemT(kBox_box, TPtr_item, sizeof(*TPtr_item))
146
154 kInlineFx(void*) kBox_Data(kBox box)
155 {
156 kObj(kBox, box);
157
158 return obj->item;
159 }
160
172 #define kBox_DataT(kBox_box, T) \
173 kCast(T*, xkBox_DataT(kBox_box, sizeof(T)))
174
182 kInlineFx(kType) kBox_ItemType(kBox box)
183 {
184 kObj(kBox, box);
185
186 return obj->itemType;
187 }
188
196 kInlineFx(kSize) kBox_ItemSize(kBox box)
197 {
198 kObj(kBox, box);
199
200 return obj->itemSize;
201 }
202
203 #endif
kBox::kBox_Construct
kStatus kBox_Construct(kBox *box, kType itemType, kAlloc allocator)
Constructs a kBox object.
kSize
Represents an unsigned integer that can store a pointer address.
kAlloc
Abstract base class for memory allocator types.
kInlineFx
#define kInlineFx(TYPE)
Inline method declaration helper.
Definition: kApiDef.h:26
kBox::kBox_Assign
kStatus kBox_Assign(kBox box, kBox source)
Copies the value contained within the source box into this box.
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:2892
kBox::kBox_ItemType
kType kBox_ItemType(kBox box)
Returns the box item type.
Definition: kBox.h:182
kApiDef.h
Core Zen type declarations.
kBox::kBox_Zero
kStatus kBox_Zero(kBox box)
Sets all box element bits to zero.
kBox
Represents an instance of a value type as an object.
kBox::kBox_Data
void * kBox_Data(kBox box)
Returns a pointer to the box item buffer.
Definition: kBox.h:154
kType
Represents metadata about a type (class, interface, or value).
kStatus
Represents an error code.
kBox::kBox_SetItem
kStatus kBox_SetItem(kBox box, const void *item)
Sets the box value.
kBox::kBox_ItemSize
kSize kBox_ItemSize(kBox box)
Returns the box item size.
Definition: kBox.h:196
kBox::kBox_Allocate
kStatus kBox_Allocate(kBox box, kType itemType)
Reallocates the internal box item buffer.
kBox::kBox_Item
kStatus kBox_Item(kBox box, void *item)
Gets the box value.