Coconut Framework  beta
Classes | Functions
CNObjectDictionary.h File Reference

Define CNObjectDictionary data structure. More...

#include "CNDictionary.h"
#include "CNObject.h"
#include "CNList.h"

Go to the source code of this file.

Classes

struct  CNObjectDictionary
 Dictionary of CNObject. More...
 

Functions

void CNInitObjectDictionary (struct CNObjectDictionary *dst, struct CNResource *resource)
 Initialize CNObjectDictionary. More...
 
static void CNDestroyObjectDictionary (struct CNObjectDictionary *dst)
 Deallocate CNObjectDictionary. More...
 
static size_t CNCountOfObjectDictionary (const struct CNObjectDictionary *src)
 Number of items in object dictionary. More...
 
static struct CNResource * CNResourceOfObjectDictionary (struct CNObjectDictionary *src)
 Get resource fot the object dictionary. More...
 
static struct CNObjectCNSearchObjectInDictionary (const struct CNObjectDictionary *dict, const struct CNFixedString *key)
 Search object in CNObject dictionary. More...
 
static void CNSetObjectToDictionary (struct CNObjectDictionary *dict, const struct CNFixedString *key, struct CNObject *value)
 Set object for key to CNObjectDictionary. More...
 
struct CNObjectList CNListOfObjectsInDictionary (const struct CNObjectDictionary *src, struct CNResource *resource)
 Allocate list of all objects in the object dictionary. More...
 
struct CNList CNListOfKeysInDictionary (struct CNObjectDictionary *src)
 Allocate list of all keys in the object dictionary. More...
 
struct CNObjectList CNElementListOfObjectDictionary (const struct CNObjectDictionary *src, struct CNResource *resource)
 Make object list of dictionary. More...
 
static CNBoolean CNVisitElementOfObjectDictionary (const struct CNObjectDictionary *src, CNVisitElementOfDictionaryFuncRef visitfunc, void *info)
 Visit all elements in the object dictionary. More...
 

Detailed Description

Define CNObjectDictionary data structure.

Copyright
Copyright (C) 2012 Steel Wheels Project

Function Documentation

void CNInitObjectDictionary ( struct CNObjectDictionary dst,
struct CNResource *  resource 
)

Initialize CNObjectDictionary.

Parameters
dstDestination dictionary
resourceResource to allocate dictionary
static void CNDestroyObjectDictionary ( struct CNObjectDictionary dst)
inlinestatic

Deallocate CNObjectDictionary.

Parameters
dstDestination dictionary

References CNDestroyDictionary(), and CNObjectDictionary::dataDictionary.

static size_t CNCountOfObjectDictionary ( const struct CNObjectDictionary src)
inlinestatic

Number of items in object dictionary.

Returns
Number of items
Parameters
srcSource object dictionary

References CNCountOfDictionary(), and CNObjectDictionary::dataDictionary.

static struct CNResource* CNResourceOfObjectDictionary ( struct CNObjectDictionary src)
static

Get resource fot the object dictionary.

Returns
Resource of this dictionary
Parameters
srcSource object dictionary

References CNResourceOfDictionary(), and CNObjectDictionary::dataDictionary.

static struct CNObject* CNSearchObjectInDictionary ( const struct CNObjectDictionary dict,
const struct CNFixedString key 
)
static

Search object in CNObject dictionary.

Return values
objMatched object
NULLNo matched object
Parameters
dictSource dictionary
keyKey string

References CNSearchDataInDictionary(), and CNObjectDictionary::dataDictionary.

static void CNSetObjectToDictionary ( struct CNObjectDictionary dict,
const struct CNFixedString key,
struct CNObject value 
)
inlinestatic

Set object for key to CNObjectDictionary.

Parameters
dictDestination dictionary
keyKey string
valueValue object

References CNRetainObject(), CNSetDataToDictionary(), and CNObjectDictionary::dataDictionary.

struct CNObjectList CNListOfObjectsInDictionary ( const struct CNObjectDictionary src,
struct CNResource *  resource 
)

Allocate list of all objects in the object dictionary.

Returns
List of all objects
Parameters
srcSource object dictionary
resourceResource to allocate the list
Note
You have to release the returned list by CNDestroyObjectList .
struct CNList CNListOfKeysInDictionary ( struct CNObjectDictionary src)

Allocate list of all keys in the object dictionary.

Returns
List of all keys (const struct CNFixedString *)
Parameters
srcSource object dictionary
Note
You have to release the returned list by CNDestroyList .
struct CNObjectList CNElementListOfObjectDictionary ( const struct CNObjectDictionary src,
struct CNResource *  resource 
)

Make object list of dictionary.

Returns
List of elements
Parameters
srcSource object dictionary
resourceResource to allocate the list
static CNBoolean CNVisitElementOfObjectDictionary ( const struct CNObjectDictionary src,
CNVisitElementOfDictionaryFuncRef  visitfunc,
void *  info 
)
inlinestatic

Visit all elements in the object dictionary.

Return values
TRUEAll elements are visited
FALSEAll elements are NOT visited
Parameters
srcSource array
visitfuncFunction which is called foreach elements
infoAdditiona parameter for visit function

References CNVisitElementOfDictionary(), and CNObjectDictionary::dataDictionary.