Design Pattern Examples
Overview of object-oriented design patterns
mapofint.h
Go to the documentation of this file.
1
5
6#pragma once
7#ifndef __MAPOFINTS_H__
8#define __MAPOFINTS_H__
9
10#include "uintarray.h"
11
15typedef struct
16{
17 const char* key;
18 int value;
20
26typedef struct
27{
30} MapOfInt;
31
44
50void MapOfInt_Clear(MapOfInt* map);
51
65bool MapOfInt_Add(MapOfInt* map, const char* key, int value);
66
75int MapOfInt_Find(MapOfInt* map, const char* key);
76
77
78#endif // __MAPOFINTS_H__
79
void MapOfInt_Clear(MapOfInt *map)
Clear the given MapOfInt object, releasing all memory associated with it. Leaves the object in an ini...
Definition: mapofint.c:28
void MapOfInt_Initialize(MapOfInt *map)
Initialize the given MapOfInt structure so it is ready for use.
Definition: mapofint.c:16
bool MapOfInt_Add(MapOfInt *map, const char *key, int value)
Add a key/value association to the given MapOfInt object. The MapOfInt object takes ownership of the ...
Definition: mapofint.c:40
int MapOfInt_Find(MapOfInt *map, const char *key)
Find the specified key in the given MapOfInt object, returning an index into the object.
Definition: mapofint.c:72
Represents an association between a string and an integer.
Definition: mapofint.h:16
int value
The integer value.
Definition: mapofint.h:18
const char * key
Key associated with this integer. Borrowed pointer.
Definition: mapofint.h:17
Represents a list of MapOfIntEntry objects that maps a string to an integer value....
Definition: mapofint.h:27
size_t entries_count
Definition: mapofint.h:29
MapOfIntEntry * entries
Definition: mapofint.h:28
Declaration of the UIntArray structure and the supporting functions that represents an array of 32-bi...