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
186 //typedef kObject kMap; --forward-declared in kApiDef.x.h
187
188
193 typedef kPointer kMapItem;
194
206 kFx(kStatus) kMap_Construct(kMap* map, kType keyType, kType valueType, kSize initialCapacity, kAlloc allocator);
207
220 kFx(kStatus) kMap_Allocate(kMap map, kType keyType, kType valueType, kSize initialCapacity);
221
233 kFx(kStatus) kMap_Assign(kMap map, kMap source);
234
243 kFx(kStatus) kMap_SetEqualsFx(kMap map, kEqualsFx function);
244
257 kFx(kSize) kMap_SetHashFx(kMap map, kHashFx function);
258
266 kFx(kType) kMap_KeyType(kMap map);
267
275 kFx(kType) kMap_ValueType(kMap map);
276
284 kFx(kSize) kMap_Count(kMap map);
285
293 kFx(kSize) kMap_Capacity(kMap map);
294
304 kFx(kStatus) kMap_Find(kMap map, const void* key, void* value);
305
315 kFx(kStatus) kMap_Add(kMap map, const void* key, const void* value);
316
330 kFx(kStatus) kMap_Replace(kMap map, const void* key, const void* value);
331
346 kFx(kStatus) kMap_Remove(kMap map, const void* key, void* oldKey, void* oldValue);
347
356 kFx(kStatus) kMap_Reserve(kMap map, kSize capacity);
357
365 kFx(kStatus) kMap_Clear(kMap map);
366
374 kFx(kStatus) kMap_Purge(kMap map);
375
383 kFx(kMapItem) kMap_First(kMap map);
384
393 kFx(kMapItem) kMap_Next(kMap map, kMapItem item);
394
404 kFx(kStatus) kMap_FindItem(kMap map, const void* key, kMapItem* item);
405
414 kFx(kStatus) kMap_RemoveItem(kMap map, kMapItem item);
415
424 kFx(const void*) kMap_Key(kMap map, kMapItem item);
425
434 kFx(void*) kMap_Value(kMap map, kMapItem item);
435
445 kFx(kStatus) kMap_SetValue(kMap map, kMapItem item, const void* value);
446
449 #define kMap_KeyType_(MAP) kxMap_KeyType_(MAP)
450 #define kMap_ValueType_(MAP) kxMap_ValueType_(MAP)
451 #define kMap_Count_(MAP) kxMap_Count_(MAP)
452
453
454 #define kMap_KeyAs_(MAP, ITEM, TYPE) kxMap_KeyAs_(MAP, ITEM, TYPE)
455
457 #define kMap_ValueAs_(MAP, ITEM, TYPE) kxMap_ValueAs_(MAP, ITEM, TYPE)
458
461 kEndHeader()
462
463 #include <kApi/Data/kMap.x.h>
464
465 #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:1470
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:1462
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.