|
Sturk 1.1.0
Publish-subscribe C implementation.
|
Dictionary. More...


Go to the source code of this file.
Data Structures | |
| struct | StDictNode |
| Dictionary node. More... | |
Macros | |
| #define | st_dict_cast(dict) |
| Get the pointer to the StDictNode member of the dictionary entry. | |
| #define | st_dict_setk(dict, key) |
| Set a key string for a dictionary entry. | |
| #define | st_dict_getk(dict) |
| Get the key string from a dictionary entry. | |
| #define | st_dict_datap(dict) |
| Get a pointer to the data member of a dictionary entry. | |
| #define | st_dict_ins(dict, entry) |
| Insert an entry into the dictionary. | |
| #define | st_dict_find(dict, key) |
| In a dictionary, find the entry with the given key. | |
| #define | st_dict_first(dict) |
| Find the first entry of the dictionary traversal. | |
| #define | st_dict_next(dict) |
| Find the next entry of the dictionary traversal. | |
| #define | ST_DICT(name, type) |
| Define the dictionary. | |
Functions | |
| struct StDictNode * | st_dictnode_ins (struct StDictNode *root, struct StDictNode *entry) |
| Insert an entry into the dictionary. | |
| struct StDictNode * | st_dictnode_find (struct StDictNode *root, const char *str) |
| In a dictionary, find the entry with the given key. | |
| static struct StDictNode * | st_dictnode_from (struct StRbNode *ptr) |
| Cast a StRbNode member out to the containing StDictNode structure. | |
Dictionary.
This header file provides data types, functions and macros that define and operate on dictionaries. These dictionaries are key-value data structures where the key is always a sequence of characters (ie. string, char array).
| #define ST_DICT | ( | name, | |
| type | |||
| ) |
Define the dictionary.
| [in] | name | The name of the type used for the dictionary. |
| [in] | type | The type of the data held by name. |
This macro will define a compound type (must be struct or union) name, a type for a dictionary entry that holds the data of the type type.
| #define st_dict_cast | ( | dict | ) |
Get the pointer to the StDictNode member of the dictionary entry.
| [in] | dict | The dictionary entry. |
| #define st_dict_datap | ( | dict | ) |
Get a pointer to the data member of a dictionary entry.
| [in] | dict | The entry. |
| #define st_dict_find | ( | dict, | |
| key | |||
| ) |
In a dictionary, find the entry with the given key.
| [in] | dict | The root. |
| [in] | key | The key string. |
| #define st_dict_first | ( | dict | ) |
Find the first entry of the dictionary traversal.
| [in] | dict | Any entry from the dictionary. |
For the lexicographical order of the dictionary keys, find the entry with the first key.
| #define st_dict_getk | ( | dict | ) |
Get the key string from a dictionary entry.
| [in] | dict | The entry. |
| #define st_dict_ins | ( | dict, | |
| entry | |||
| ) |
Insert an entry into the dictionary.
| [in,out] | dict | The root. |
| [in,out] | entry | The new entry. |
| #define st_dict_next | ( | dict | ) |
Find the next entry of the dictionary traversal.
For the lexicographical order of the dictionary keys, find the entry with the next key.
| [in] | dict | The entry. |
| #define st_dict_setk | ( | dict, | |
| key | |||
| ) |
Set a key string for a dictionary entry.
| [in] | dict | The entry. |
| [in] | key | The key string. |
| struct StDictNode * st_dictnode_find | ( | struct StDictNode * | root, |
| const char * | str | ||
| ) |
In a dictionary, find the entry with the given key.
| [in] | root | The root. |
| [in] | str | The key string. |
|
inlinestatic |
Cast a StRbNode member out to the containing StDictNode structure.
| [in] | ptr | The pointer to the StRbNode member. |
| struct StDictNode * st_dictnode_ins | ( | struct StDictNode * | root, |
| struct StDictNode * | entry | ||
| ) |
Insert an entry into the dictionary.
| [in,out] | root | The root. |
| [in,out] | entry | The new entry. |