Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of azure_c_shared_utility by
constmap.h File Reference
ConstMap is a module that implements a read-only dictionary of const
char* keys to const
char* values.
More...
Go to the source code of this file.
Functions | |
DEFINE_ENUM (CONSTMAP_RESULT, CONSTMAP_RESULT_VALUES) | |
Enumeration specifying the status of calls to various APIs in this module. | |
MOCKABLE_FUNCTION (, CONSTMAP_HANDLE, ConstMap_Create, MAP_HANDLE, sourceMap) | |
Creates a new read-only map from a map handle. | |
MOCKABLE_FUNCTION (, void, ConstMap_Destroy, CONSTMAP_HANDLE, handle) | |
Destroy a read-only map. | |
MOCKABLE_FUNCTION (, CONSTMAP_HANDLE, ConstMap_Clone, CONSTMAP_HANDLE, handle) | |
Clone a read-only map from another read-only map. | |
MOCKABLE_FUNCTION (, MAP_HANDLE, ConstMap_CloneWriteable, CONSTMAP_HANDLE, handle) | |
Create a map handle populated from the read-only map. | |
MOCKABLE_FUNCTION (, bool, ConstMap_ContainsKey, CONSTMAP_HANDLE, handle, const char *, key) | |
This function returns a true if the map contains a key with the same value the parameter key . | |
MOCKABLE_FUNCTION (, bool, ConstMap_ContainsValue, CONSTMAP_HANDLE, handle, const char *, value) | |
This function returns true if at least one <key,value> pair exists in the map where the entry's value is equal to the parameter value . | |
MOCKABLE_FUNCTION (, const char *, ConstMap_GetValue, CONSTMAP_HANDLE, handle, const char *, key) | |
Retrieves the value of a stored key. | |
MOCKABLE_FUNCTION (, CONSTMAP_RESULT, ConstMap_GetInternals, CONSTMAP_HANDLE, handle, const char *const **, keys, const char *const **, values, size_t *, count) | |
Retrieves the complete list of keys and values from the map in values and keys . |
Detailed Description
ConstMap is a module that implements a read-only dictionary of const
char* keys to const
char* values.
Definition in file constmap.h.
Function Documentation
DEFINE_ENUM | ( | CONSTMAP_RESULT | , |
CONSTMAP_RESULT_VALUES | |||
) |
Enumeration specifying the status of calls to various APIs in this module.
MOCKABLE_FUNCTION | ( | CONSTMAP_RESULT | , |
ConstMap_GetInternals | , | ||
CONSTMAP_HANDLE | , | ||
handle | , | ||
const char *const ** | , | ||
keys | , | ||
const char *const ** | , | ||
values | , | ||
size_t * | , | ||
count | |||
) |
Retrieves the complete list of keys and values from the map in values
and keys
.
Also writes the size of the list in count
.
- Parameters:
-
handle The handle to an existing map. keys The location where the list of keys is to be written. values The location where the list of values is to be written. count The number of stored keys and values is written at the location indicated by this pointer.
- Returns:
- Returns
CONSTMAP_OK
if the keys and values are retrieved and written successfully or an error code otherwise.
MOCKABLE_FUNCTION | ( | const char * | , |
ConstMap_GetValue | , | ||
CONSTMAP_HANDLE | , | ||
handle | , | ||
const char * | , | ||
key | |||
) |
Retrieves the value of a stored key.
- Parameters:
-
handle The handle to an existing map. key The key to be looked up in the map.
- Returns:
- Returns
NULL
in case the input arguments areNULL
or if the requested key is not found in the map. Returns a pointer to the key's value otherwise.
MOCKABLE_FUNCTION | ( | bool | , |
ConstMap_ContainsValue | , | ||
CONSTMAP_HANDLE | , | ||
handle | , | ||
const char * | , | ||
value | |||
) |
This function returns true
if at least one <key,value> pair exists in the map where the entry's value is equal to the parameter value
.
- Parameters:
-
handle The handle to an existing map. value The value that the caller wants checked.
- Returns:
- The function returns
true
if the value exists in the map andfalse
if value is not found or parameters are invalid.
MOCKABLE_FUNCTION | ( | bool | , |
ConstMap_ContainsKey | , | ||
CONSTMAP_HANDLE | , | ||
handle | , | ||
const char * | , | ||
key | |||
) |
This function returns a true if the map contains a key with the same value the parameter key
.
- Parameters:
-
handle The handle to an existing map. key The key that the caller wants checked.
- Returns:
- The function returns
true
if the key exists in the map andfalse
if key is not found or parameters are invalid.
MOCKABLE_FUNCTION | ( | MAP_HANDLE | , |
ConstMap_CloneWriteable | , | ||
CONSTMAP_HANDLE | , | ||
handle | |||
) |
Create a map handle populated from the read-only map.
- Parameters:
-
handle Handle to a read-only map.
- Returns:
- A valid
MAP_HANDLE
orNULL
in case an error occurs.
The new MAP_HANDLE needs to be destroyed when it is no longer needed.
MOCKABLE_FUNCTION | ( | CONSTMAP_HANDLE | , |
ConstMap_Clone | , | ||
CONSTMAP_HANDLE | , | ||
handle | |||
) |
Clone a read-only map from another read-only map.
- Parameters:
-
handle Handle to a read-only map.
- Returns:
- A valid
CONSTMAP_HANDLE
orNULL
in case an error occurs.
MOCKABLE_FUNCTION | ( | void | , |
ConstMap_Destroy | , | ||
CONSTMAP_HANDLE | , | ||
handle | |||
) |
Destroy a read-only map.
Deallocate memory associated with handle.
- Parameters:
-
handle Handle to a read-only map.
MOCKABLE_FUNCTION | ( | CONSTMAP_HANDLE | , |
ConstMap_Create | , | ||
MAP_HANDLE | , | ||
sourceMap | |||
) |
Creates a new read-only map from a map handle.
- Parameters:
-
sourceMap The map from which we will populate key,value into the read-only map.
- Returns:
- A valid
CONSTMAP_HANDLE
orNULL
in case an error occurs.
Generated on Tue Jul 12 2022 19:14:38 by
