FreeRDP
ListDictionary.c File Reference
#include <winpr/config.h>
#include <winpr/assert.h>
#include <winpr/crt.h>
#include <winpr/collections.h>

Functions

WINPR_API wObjectListDictionary_KeyObject (wListDictionary *_dictionary)
 Get the wObject function pointer struct for the key of the dictionary. More...
 
WINPR_API wObjectListDictionary_ValueObject (wListDictionary *_dictionary)
 Get the wObject function pointer struct for the value of the dictionary. More...
 
size_t ListDictionary_Count (wListDictionary *listDictionary)
 Return the number of entries in the dictionary. More...
 
void ListDictionary_Lock (wListDictionary *listDictionary)
 mutex-lock a dictionary More...
 
void ListDictionary_Unlock (wListDictionary *listDictionary)
 mutex-unlock a dictionary More...
 
size_t ListDictionary_GetKeys (wListDictionary *listDictionary, ULONG_PTR **ppKeys)
 return all keys the dictionary contains More...
 
static void item_free (wListDictionary *listDictionary, wListDictionaryItem *item)
 
static void item_set (wListDictionary *listDictionary, wListDictionaryItem *item, const void *value)
 
static wListDictionaryItem * new_item (wListDictionary *listDictionary, const void *key, const void *value)
 
BOOL ListDictionary_Add (wListDictionary *listDictionary, const void *key, const void *value)
 mutex-lock a dictionary More...
 
void ListDictionary_Clear (wListDictionary *listDictionary)
 Remove all items from the dictionary and call fnObjectFree for key and value. More...
 
BOOL ListDictionary_Contains (wListDictionary *listDictionary, const void *key)
 Check if a dictionary contains key (fnObjectEquals of the key object is called) More...
 
static void * ListDictionary_RemoveOrTake (wListDictionary *listDictionary, const void *key, BOOL take)
 
void ListDictionary_Remove (wListDictionary *listDictionary, const void *key)
 Remove an item from the dictionary and call fnObjectFree for key and value. More...
 
void * ListDictionary_Take (wListDictionary *listDictionary, const void *key)
 Remove an item from the dictionary and return the value. Cleanup is up to the caller. More...
 
static void * ListDictionary_Remove_Or_Take_Head (wListDictionary *listDictionary, BOOL take)
 
void ListDictionary_Remove_Head (wListDictionary *listDictionary)
 Remove the head item from the dictionary and call fnObjectFree for key and value. More...
 
void * ListDictionary_Take_Head (wListDictionary *listDictionary)
 Remove the head item from the dictionary and return the value. Cleanup is up to the caller. More...
 
void * ListDictionary_GetItemValue (wListDictionary *listDictionary, const void *key)
 Get the value in the dictionary for a key. The ownership of the data stays with the dictionary. More...
 
BOOL ListDictionary_SetItemValue (wListDictionary *listDictionary, const void *key, const void *value)
 Set the value in the dictionary for a key. The entry must already exist, value is copied if fnObjectNew is set. More...
 
static BOOL default_equal_function (const void *obj1, const void *obj2)
 
wListDictionary * ListDictionary_New (BOOL synchronized)
 allocate a new dictionary More...
 
void ListDictionary_Free (wListDictionary *listDictionary)
 Free memory allocated by a dictionary. Calls ListDictionary_Clear. More...
 

Function Documentation

◆ default_equal_function()

static BOOL default_equal_function ( const void *  obj1,
const void *  obj2 
)
static
Here is the caller graph for this function:

◆ item_free()

static void item_free ( wListDictionary *  listDictionary,
wListDictionaryItem *  item 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ item_set()

static void item_set ( wListDictionary *  listDictionary,
wListDictionaryItem *  item,
const void *  value 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ListDictionary_Add()

BOOL ListDictionary_Add ( wListDictionary *  listDictionary,
const void *  key,
const void *  value 
)

mutex-lock a dictionary

Adds an entry with the specified key and value into the ListDictionary.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ListDictionary_Clear()

void ListDictionary_Clear ( wListDictionary *  listDictionary)

Remove all items from the dictionary and call fnObjectFree for key and value.

Removes all entries from the ListDictionary.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ListDictionary_Contains()

BOOL ListDictionary_Contains ( wListDictionary *  listDictionary,
const void *  key 
)

Check if a dictionary contains key (fnObjectEquals of the key object is called)

Determines whether the ListDictionary contains a specific key.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ListDictionary_Count()

size_t ListDictionary_Count ( wListDictionary *  listDictionary)

Return the number of entries in the dictionary.

Properties Gets the number of key/value pairs contained in the ListDictionary.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ListDictionary_Free()

void ListDictionary_Free ( wListDictionary *  listDictionary)

Free memory allocated by a dictionary. Calls ListDictionary_Clear.

Parameters
listDictionaryA dictionary to query, may be NULL
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ListDictionary_GetItemValue()

void* ListDictionary_GetItemValue ( wListDictionary *  listDictionary,
const void *  key 
)

Get the value in the dictionary for a key. The ownership of the data stays with the dictionary.

Get an item value using key

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ListDictionary_GetKeys()

size_t ListDictionary_GetKeys ( wListDictionary *  listDictionary,
ULONG_PTR **  ppKeys 
)

return all keys the dictionary contains

Methods Gets the list of keys as an array

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ListDictionary_KeyObject()

WINPR_API wObject* ListDictionary_KeyObject ( wListDictionary *  _dictionary)

Get the wObject function pointer struct for the key of the dictionary.

C equivalent of the C# ListDictionary Class: http://msdn.microsoft.com/en-us/library/system.collections.specialized.listdictionary.aspx

Internal implementation uses a singly-linked list

Here is the caller graph for this function:

◆ ListDictionary_Lock()

void ListDictionary_Lock ( wListDictionary *  listDictionary)

mutex-lock a dictionary

Lock access to the ListDictionary

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ListDictionary_New()

wListDictionary* ListDictionary_New ( BOOL  synchronized)

allocate a new dictionary

Construction, Destruction

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ListDictionary_Remove()

void ListDictionary_Remove ( wListDictionary *  listDictionary,
const void *  key 
)

Remove an item from the dictionary and call fnObjectFree for key and value.

Parameters
listDictionaryA dictionary to query, must not be NULL
keyThe key identifying the entry
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ListDictionary_Remove_Head()

void ListDictionary_Remove_Head ( wListDictionary *  listDictionary)

Remove the head item from the dictionary and call fnObjectFree for key and value.

Parameters
listDictionaryA dictionary to query, must not be NULL
Here is the call graph for this function:

◆ ListDictionary_Remove_Or_Take_Head()

static void* ListDictionary_Remove_Or_Take_Head ( wListDictionary *  listDictionary,
BOOL  take 
)
static

Removes the first (head) entry from the list

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ListDictionary_RemoveOrTake()

static void* ListDictionary_RemoveOrTake ( wListDictionary *  listDictionary,
const void *  key,
BOOL  take 
)
static

Removes the entry with the specified key from the ListDictionary.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ListDictionary_SetItemValue()

BOOL ListDictionary_SetItemValue ( wListDictionary *  listDictionary,
const void *  key,
const void *  value 
)

Set the value in the dictionary for a key. The entry must already exist, value is copied if fnObjectNew is set.

Set an item value using key

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ListDictionary_Take()

void* ListDictionary_Take ( wListDictionary *  listDictionary,
const void *  key 
)

Remove an item from the dictionary and return the value. Cleanup is up to the caller.

Parameters
listDictionaryA dictionary to query, must not be NULL
keyThe key identifying the entry
Returns
a pointer to the value stored or NULL in case of failure or not found
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ListDictionary_Take_Head()

void* ListDictionary_Take_Head ( wListDictionary *  listDictionary)

Remove the head item from the dictionary and return the value. Cleanup is up to the caller.

Parameters
listDictionaryA dictionary to query, must not be NULL
Returns
a pointer to the value stored or NULL in case of failure or not found
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ListDictionary_Unlock()

void ListDictionary_Unlock ( wListDictionary *  listDictionary)

mutex-unlock a dictionary

Unlock access to the ListDictionary

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ListDictionary_ValueObject()

WINPR_API wObject* ListDictionary_ValueObject ( wListDictionary *  listDictionary)

Get the wObject function pointer struct for the value of the dictionary.

Parameters
listDictionaryA dictionary to query, must not be NULL
Returns
a wObject used to initialize the value object, NULL in case of failure
Here is the caller graph for this function:

◆ new_item()

static wListDictionaryItem* new_item ( wListDictionary *  listDictionary,
const void *  key,
const void *  value 
)
static
Here is the call graph for this function:
Here is the caller graph for this function: