Coconut Framework  beta
CNObjectDictionary.h
Go to the documentation of this file.
1 
8 #ifndef CNOBJECTDICTIONARY_H
9 #define CNOBJECTDICTIONARY_H
10 
11 #include "CNDictionary.h"
12 #include "CNObject.h"
13 #include "CNList.h"
14 
19 {
22 } ;
23 
29 void
30 CNInitObjectDictionary(struct CNObjectDictionary * dst, struct CNResource * resource) ;
31 
36 static inline void
38 {
40 }
41 
47 static inline size_t
49 {
50  return CNCountOfDictionary(&(src->dataDictionary)) ;
51 }
52 
58 static inline struct CNResource *
60 {
61  return CNResourceOfDictionary(&(src->dataDictionary)) ;
62 }
63 
71 static inline struct CNObject *
72 CNSearchObjectInDictionary(const struct CNObjectDictionary * dict,const struct CNFixedString * key)
73 {
74  return CNSearchDataInDictionary(&(dict->dataDictionary), key) ;
75 }
76 
83 static inline void
84 CNSetObjectToDictionary(struct CNObjectDictionary * dict, const struct CNFixedString * key, struct CNObject * value)
85 {
86  CNRetainObject(value) ;
87  CNSetDataToDictionary(&(dict->dataDictionary), key, value) ;
88 }
89 
98 struct CNObjectList
99 CNListOfObjectsInDictionary(const struct CNObjectDictionary * src, struct CNResource * resource) ;
100 
108 struct CNList
110 
117 struct CNObjectList
118 CNElementListOfObjectDictionary(const struct CNObjectDictionary * src, struct CNResource * resource) ;
119 
128 static inline CNBoolean
130 {
131  return CNVisitElementOfDictionary(&(src->dataDictionary), visitfunc, info) ;
132 }
133 
134 #endif /* CNOBJECTDICTIONARY_H */
135 
struct CNList CNListOfKeysInDictionary(struct CNObjectDictionary *src)
Allocate list of all keys in the object dictionary.
static struct CNObject * CNSearchObjectInDictionary(const struct CNObjectDictionary *dict, const struct CNFixedString *key)
Search object in CNObject dictionary.
Definition: CNObjectDictionary.h:72
static struct CNResource * CNResourceOfObjectDictionary(struct CNObjectDictionary *src)
Get resource fot the object dictionary.
Definition: CNObjectDictionary.h:59
Define CNDictionary data structure.
List of pointers.
Definition: CNList.h:17
struct CNDictionary dataDictionary
Definition: CNObjectDictionary.h:21
static CNBoolean CNVisitElementOfObjectDictionary(const struct CNObjectDictionary *src, CNVisitElementOfDictionaryFuncRef visitfunc, void *info)
Visit all elements in the object dictionary.
Definition: CNObjectDictionary.h:129
void * CNSearchDataInDictionary(const struct CNDictionary *dict, const struct CNFixedString *key)
Search data in data dictionary.
Persistent string. There are only one object for each context of string.
Definition: CNFixedString.h:21
Define CNList data structure.
Dictionary of CNObject.
Definition: CNObjectDictionary.h:18
List of CNObject.
Definition: CNObjectList.h:17
Root object.
Definition: CNObject.h:38
static void CNDestroyObjectDictionary(struct CNObjectDictionary *dst)
Deallocate CNObjectDictionary.
Definition: CNObjectDictionary.h:37
static void CNSetObjectToDictionary(struct CNObjectDictionary *dict, const struct CNFixedString *key, struct CNObject *value)
Set object for key to CNObjectDictionary.
Definition: CNObjectDictionary.h:84
struct CNObjectList CNListOfObjectsInDictionary(const struct CNObjectDictionary *src, struct CNResource *resource)
Allocate list of all objects in the object dictionary.
Define CNObject data structure.
struct CNObjectList CNElementListOfObjectDictionary(const struct CNObjectDictionary *src, struct CNResource *resource)
Make object list of dictionary.
Dictionary of pointer.
Definition: CNDictionary.h:28
static void CNRetainObject(struct CNObject *dst)
Retain the object.
Definition: CNObject.h:75
static struct CNResource * CNResourceOfDictionary(struct CNDictionary *src)
Get resource fot the dictionary.
Definition: CNDictionary.h:73
void CNInitObjectDictionary(struct CNObjectDictionary *dst, struct CNResource *resource)
Initialize CNObjectDictionary.
static size_t CNCountOfDictionary(const struct CNDictionary *src)
Number of items in dictionary.
Definition: CNDictionary.h:62
CNBoolean CNVisitElementOfDictionary(const struct CNDictionary *src, CNVisitElementOfDictionaryFuncRef visitfunc, void *info)
Visit all elements in the dictionary.
void CNDestroyDictionary(struct CNDictionary *dst)
Deallocate CNDictionary.
CNBoolean(* CNVisitElementOfDictionaryFuncRef)(const struct CNFixedString *key, void *src, void *info)
Definition: CNDictionary.h:21
void CNSetDataToDictionary(struct CNDictionary *dict, const struct CNFixedString *key, void *value)
Set data for key to CNDictionary.
static size_t CNCountOfObjectDictionary(const struct CNObjectDictionary *src)
Number of items in object dictionary.
Definition: CNObjectDictionary.h:48
unsigned int CNBoolean
Boolean type.
Definition: CNType.h:14
struct CNResource * resource
Definition: CNDictionary.h:31