Pajdeg  0.2.2
Pajdeg
PDDictionary.h
Go to the documentation of this file.
1 //
2 // PDDictionary.h
3 //
4 // Copyright (c) 2012 - 2015 Karl-Johan Alm (http://github.com/kallewoof)
5 //
6 // Permission is hereby granted, free of charge, to any person obtaining a copy
7 // of this software and associated documentation files (the "Software"), to deal
8 // in the Software without restriction, including without limitation the rights
9 // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 // copies of the Software, and to permit persons to whom the Software is
11 // furnished to do so, subject to the following conditions:
12 //
13 // The above copyright notice and this permission notice shall be included in
14 // all copies or substantial portions of the Software.
15 //
16 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 // THE SOFTWARE.
23 //
24 
39 #ifndef INCLUDED_PDDICTIONARY_H
40 #define INCLUDED_PDDICTIONARY_H
41 
42 #include "PDDefines.h"
43 
50 
60 
69 
79 
89 
98 extern void PDDictionarySet(PDDictionaryRef hm, const char *key, void *value);
99 
106 extern void *PDDictionaryGet(PDDictionaryRef hm, const char *key);
107 
114 extern void PDDictionaryDelete(PDDictionaryRef hm, const char *key);
115 
124 
132 extern void PDDictionaryIterate(PDDictionaryRef hm, PDHashIterator it, void *ui);
133 
142 extern void PDDictionaryPopulateKeys(PDDictionaryRef hm, char **keys);
143 
149 extern void PDDictionaryClear(PDDictionaryRef hm);
150 
156 extern void PDDictionaryPrint(PDDictionaryRef hm);
157 
167 extern char *PDDictionaryToString(PDDictionaryRef hm);
168 
169 extern PDInteger PDDictionaryPrinter(void *inst, char **buf, PDInteger offs, PDInteger *cap);
170 
171 extern void *PDDictionaryGetTyped(PDDictionaryRef dictionary, const char *key, PDInstanceType type);
172 
173 #define PDDictionaryGetString(d,k) PDDictionaryGetTyped(d,k,PDInstanceTypeString)
174 #define PDDictionaryGetArray(d,k) PDDictionaryGetTyped(d,k,PDInstanceTypeArray)
175 #define PDDictionaryGetDictionary(d,k) PDDictionaryGetTyped(d,k,PDInstanceTypeDict)
176 #define PDDictionaryGetReference(d,k) PDDictionaryGetTyped(d,k,PDInstanceTypeRef)
177 #define PDDictionaryGetObject(d,k) PDDictionaryGetTyped(d,k,PDInstanceTypeObj)
178 
182 #define PDDictionaryGetInteger(d,k) PDNumberGetInteger(PDDictionaryGet(d,k))
183 
184 #ifdef PD_SUPPORT_CRYPTO
185 
194 extern void PDDictionaryAttachCrypto(PDDictionaryRef hm, pd_crypto crypto, PDInteger objectID, PDInteger genNumber);
195 
196 #endif // PD_SUPPORT_CRYPTO
197 
198 #endif // INCLUDED_PDDICTIONARY_H
199 
long PDInteger
Definition: PDDefines.h:184
void PDDictionarySet(PDDictionaryRef hm, const char *key, void *value)
Definition: PDDictionary.c:326
void PDDictionaryIterate(PDDictionaryRef hm, PDHashIterator it, void *ui)
Definition: PDDictionary.c:404
void PDDictionaryPopulateKeys(PDDictionaryRef hm, char **keys)
Definition: PDDictionary.c:461
PDSize PDDictionaryGetCount(PDDictionaryRef hm)
Definition: PDDictionary.c:399
PDInstanceType
Definition: PDDefines.h:557
PDDictionaryRef PDDictionaryCreateWithKeyValueDefinition(const void **defs)
Definition: PDDictionary.c:214
size_t PDSize
Definition: PDDefines.h:213
PDDictionaryRef PDDictionaryCreateWithBucketCount(PDSize bucketCount)
Definition: PDDictionary.c:193
void * PDDictionaryGet(PDDictionaryRef hm, const char *key)
Definition: PDDictionary.c:358
Definition: pd_internal.h:718
Definition: pd_internal.h:544
Definition: pd_internal.h:639
void PDDictionaryDelete(PDDictionaryRef hm, const char *key)
Definition: PDDictionary.c:375
Definitions for the Pajdeg interface.
char * PDDictionaryToString(PDDictionaryRef hm)
Definition: PDDictionary.c:469
void PDDictionaryClear(PDDictionaryRef hm)
Definition: PDDictionary.c:388
void(* PDHashIterator)(char *key, void *value, void *userInfo, PDBool *shouldStop)
Definition: PDDefines.h:355
void PDDictionaryPrint(PDDictionaryRef hm)
Definition: PDDictionary.c:477
void PDDictionaryAddEntriesFromComplex(PDDictionaryRef hm, pd_stack stack)
Definition: PDDictionary.c:229
PDDictionaryRef PDDictionaryCreate()
Definition: PDDictionary.c:202
PDDictionaryRef PDDictionaryCreateWithComplex(pd_stack stack)
Definition: PDDictionary.c:207
void PDDictionaryAttachCrypto(PDDictionaryRef hm, pd_crypto crypto, PDInteger objectID, PDInteger genNumber)
Definition: PDDictionary.c:516