Zen API

- Home
- Topics
- Types
- Files

All Classes Files Functions Variables Typedefs Friends Macros Modules Pages
kMap.h
Go to the documentation of this file.
1
10 #ifndef K_API_MAP_H
11 #define K_API_MAP_H
12
13 #include <kApi/kApiDef.h>
14
15 kBeginHeader()
16
17
34 //typedef kObject kMap; --forward-declared in kApiDef.x.h
35
36
41 typedef kPointer kMapItem;
42
54 kFx(kStatus) kMap_Construct(kMap* map, kType keyType, kType valueType, kSize initialCapacity, kAlloc allocator);
55
68 kFx(kStatus) kMap_Allocate(kMap map, kType keyType, kType valueType, kSize initialCapacity);
69
81 kFx(kStatus) kMap_Assign(kMap map, kMap source);
82
91 kFx(kStatus) kMap_SetEqualsFx(kMap map, kEqualsFx function);
92
105 kFx(kSize) kMap_SetHashFx(kMap map, kHashFx function);
106
114 kFx(kType) kMap_KeyType(kMap map);
115
123 kFx(kType) kMap_ValueType(kMap map);
124
132 kFx(kSize) kMap_Count(kMap map);
133
141 kFx(kSize) kMap_Capacity(kMap map);
142
152 kFx(kStatus) kMap_Find(kMap map, const void* key, void* value);
153
163 kFx(kStatus) kMap_Add(kMap map, const void* key, const void* value);
164
174 kFx(kStatus) kMap_Replace(kMap map, const void* key, const void* value);
175
186 kFx(kStatus) kMap_Remove(kMap map, const void* key, void* oldKey, void* oldValue);
187
196 kFx(kStatus) kMap_Reserve(kMap map, kSize capacity);
197
205 kFx(kStatus) kMap_Clear(kMap map);
206
214 kFx(kStatus) kMap_Purge(kMap map);
215
223 kFx(kMapItem) kMap_First(kMap map);
224
233 kFx(kMapItem) kMap_Next(kMap map, kMapItem item);
234
244 kFx(kStatus) kMap_FindItem(kMap map, const void* key, kMapItem* item);
245
254 kFx(kStatus) kMap_RemoveItem(kMap map, kMapItem item);
255
264 kFx(const void*) kMap_Key(kMap map, kMapItem item);
265
274 kFx(void*) kMap_Value(kMap map, kMapItem item);
275
285 kFx(kStatus) kMap_SetValue(kMap map, kMapItem item, const void* value);
286
289 #define kMap_KeyType_(MAP) kxMap_KeyType_(MAP)
290 #define kMap_ValueType_(MAP) kxMap_ValueType_(MAP)
291 #define kMap_Count_(MAP) kxMap_Count_(MAP)
292
293
294 #define kMap_KeyAs_(MAP, ITEM, TYPE) kxMap_KeyAs_(MAP, ITEM, TYPE)
295
297 #define kMap_ValueAs_(MAP, ITEM, TYPE) kxMap_ValueAs_(MAP, ITEM, TYPE)
298
301 kEndHeader()
302
303 #include <kApi/Data/kMap.x.h>
304
305 #endif
kMap::kMap_Purge
kStatus kMap_Purge(kMap map)
Disposes any elements in the map and sets the count of map items to zero.
kMap::kMap_Find
kStatus kMap_Find(kMap map, const void *key, void *value)
Finds the value associated with the given key.
kMap::kMap_Clear
kStatus kMap_Clear(kMap map)
Sets the count of map items to zero.
kMap::kMap_SetEqualsFx
kStatus kMap_SetEqualsFx(kMap map, kEqualsFx function)
Sets a custom key equality comparator.
kMap::kMap_First
kMapItem kMap_First(kMap map)
Gets a reference to the first map item (key-value pair).
kPointer
Represents a void pointer.
kMap::kMap_Count
kSize kMap_Count(kMap map)
Returns the count of map elements.
kMap::kMap_Allocate
kStatus kMap_Allocate(kMap map, kType keyType, kType valueType, kSize initialCapacity)
Reallocates the map.
kSize
Represents an unsigned integer that can store a pointer address.
kAlloc
Abstract base class for memory allocator types.
kMap::kMap_Construct
kStatus kMap_Construct(kMap *map, kType keyType, kType valueType, kSize initialCapacity, kAlloc allocator)
Constructs a kMap object.
kMap::kMap_Reserve
kStatus kMap_Reserve(kMap map, kSize capacity)
Ensures that capacity is reserved for at least the specified number of map items. ...
kMap::kMap_SetHashFx
kSize kMap_SetHashFx(kMap map, kHashFx function)
Sets a custom hash code generator.
kMap::kMap_Key
const void * kMap_Key(kMap map, kMapItem item)
Returns a pointer to the key associated with a map item.
kMap::kMap_ValueType
kType kMap_ValueType(kMap map)
Returns the value type.
kHashFx
kSize(kCall * kHashFx)(const void *item)
Callback signature to determine hash code of an item.
Definition: kApiDef.h:1440
kMap::kMap_Capacity
kSize kMap_Capacity(kMap map)
Returns the number of elements for which space has been allocated.
kMap::kMap_Add
kStatus kMap_Add(kMap map, const void *key, const void *value)
Adds a new key-value pair.
kEqualsFx
kBool(kCall * kEqualsFx)(const void *item1, const void *item2)
Callback signature to determine equality of two items.
Definition: kApiDef.h:1432
kMap::kMap_FindItem
kStatus kMap_FindItem(kMap map, const void *key, kMapItem *item)
Finds the map item associated with the given key.
kMap::kMap_Assign
kStatus kMap_Assign(kMap map, kMap source)
Performs a shallow copy of the source map.
kApiDef.h
Core Zen type declarations.
kMap::kMap_KeyType
kType kMap_KeyType(kMap map)
Returns the key type.
kMap::kMap_Next
kMapItem kMap_Next(kMap map, kMapItem item)
Given a map item, gets a reference to the next map item.
kMap::kMap_RemoveItem
kStatus kMap_RemoveItem(kMap map, kMapItem item)
Removes an item from the map.
kMap::kMap_Replace
kStatus kMap_Replace(kMap map, const void *key, const void *value)
Adds or replaces a key-value pair.
kMap::kMap_Remove
kStatus kMap_Remove(kMap map, const void *key, void *oldKey, void *oldValue)
Removes a key-value pair from the map.
kMap::kMap_SetValue
kStatus kMap_SetValue(kMap map, kMapItem item, const void *value)
Sets the value associated with a map item.
kType
Represents metadata about a type (class, interface, or value).
kMap::kMap_Value
void * kMap_Value(kMap map, kMapItem item)
Returns a pointer to the value associated with a map item.
kStatus
Represents an error code.
kMap
Represents a collection of key-value pairs stored in a hash table.