A hash map construct.
More...
|
#define | PDDictionaryGetString(d, k) PDDictionaryGetTyped(d,k,PDInstanceTypeString) |
|
#define | PDDictionaryGetArray(d, k) PDDictionaryGetTyped(d,k,PDInstanceTypeArray) |
|
#define | PDDictionaryGetDictionary(d, k) PDDictionaryGetTyped(d,k,PDInstanceTypeDict) |
|
#define | PDDictionaryGetReference(d, k) PDDictionaryGetTyped(d,k,PDInstanceTypeRef) |
|
#define | PDDictionaryGetObject(d, k) PDDictionaryGetTyped(d,k,PDInstanceTypeObj) |
|
#define | PDDictionaryGetInteger(d, k) PDNumberGetInteger(PDDictionaryGet(d,k)) |
|
|
PDDictionaryRef | PDDictionaryCreate () |
|
PDDictionaryRef | PDDictionaryCreateWithBucketCount (PDSize bucketCount) |
|
PDDictionaryRef | PDDictionaryCreateWithComplex (pd_stack stack) |
|
PDDictionaryRef | PDDictionaryCreateWithKeyValueDefinition (const void **defs) |
|
void | PDDictionaryAddEntriesFromComplex (PDDictionaryRef hm, pd_stack stack) |
|
void | PDDictionarySet (PDDictionaryRef hm, const char *key, void *value) |
|
void * | PDDictionaryGet (PDDictionaryRef hm, const char *key) |
|
void | PDDictionaryDelete (PDDictionaryRef hm, const char *key) |
|
PDSize | PDDictionaryGetCount (PDDictionaryRef hm) |
|
void | PDDictionaryIterate (PDDictionaryRef hm, PDHashIterator it, void *ui) |
|
void | PDDictionaryPopulateKeys (PDDictionaryRef hm, char **keys) |
|
void | PDDictionaryClear (PDDictionaryRef hm) |
|
void | PDDictionaryPrint (PDDictionaryRef hm) |
|
char * | PDDictionaryToString (PDDictionaryRef hm) |
|
PDInteger | PDDictionaryPrinter (void *inst, char **buf, PDInteger offs, PDInteger *cap) |
|
void * | PDDictionaryGetTyped (PDDictionaryRef dictionary, const char *key, PDInstanceType type) |
|
void | PDDictionaryAttachCrypto (PDDictionaryRef hm, pd_crypto crypto, PDInteger objectID, PDInteger genNumber) |
|
A hash map construct.
PDDictionary is a simple hash map implementation, with C string keys and PDType values.
#define PDDictionaryGetInteger |
( |
|
d, |
|
|
|
k |
|
) |
| PDNumberGetInteger(PDDictionaryGet(d,k)) |
A hash map implementation.
The hash map construct.
Add all entries from the given PDF dictionary stack to this hash map. Entries will replace pre-existing key/value pairs when a key in the pd_stack matches the key in the hash map.
- Parameters
-
hm | Hash map to add entries to |
stack | PDF dictionary stack |
Supply a crypto object to a hash map, and associate the hash map with a specific object.
- Parameters
-
hm | The hash map |
crypto | The pd_crypt object |
objectID | The object ID of the owning object |
genNumber | Generation number of the owning object |
Remove all entries in the dictionary.
- Parameters
-
Create a hash map with C string keys using default number of buckets.
- Returns
- New hash map
Create a hash map with the given number of buckets. The hash map uses C string keys.
- Parameters
-
bucketCount | Number of buckets to use in the hash map |
- Returns
- New hash map
Create a hash map with a complex object (a PDF dictionary stack).
- Parameters
-
stack | PDF dictionary stack |
- Returns
- PDDictionary containing the PDF dictionary content
PDDictionaryRef PDDictionaryCreateWithKeyValueDefinition |
( |
const void ** |
defs | ) |
|
Create a dictionary using the key, value, key2, value2, ... PDDefs() definitions in defs.
- Parameters
-
defs | A PDDefs() entry with key, value, key, value pairs |
- Returns
- PDDictionary with the corresponding entries.
Delete the given key from the hash map
- Parameters
-
hm | The hash map |
key | The key to delete |
Get the value of the given key.
- Parameters
-
hm | The hash map |
key | The key |
Get the number of items in the hash map currently.
- Parameters
-
- Returns
- The number of inserted key/value pairs
Iterate over the hash map entries using the given iterator.
- Parameters
-
hm | The hash map whose key/value pairs should be iterated |
it | The iterating function |
ui | User information to pass to iterator, if any |
Fill in the keys array with the keys in the dictionary.
- Note
- keys must have at minimum PDDictionaryGetCount(hm) number of available slots.
- Parameters
-
hm | Hash map |
keys | Pre-allocated array to populate |
Print the hash map content to stdout.
- Parameters
-
void PDDictionarySet |
( |
PDDictionaryRef |
hm, |
|
|
const char * |
key, |
|
|
void * |
value |
|
) |
| |
Set key to value. If value is NULL, an assertion is thrown. To delete keys, use PDDictionaryDelete().
- Parameters
-
hm | The hash map |
key | The key |
value | The value |
Generate a C string formatted according to the PDF specification for this hash map.
- Note
- The returned string must be freed.
- Parameters
-
- Returns
- C string representation of hash map, as a PDF dictionary