Pajdeg  0.2.2
Pajdeg
Files | Typedefs | Functions
PDDictionaryStack

A stack of dictionaries. More...

Files

file  PDDictionaryStack.h
 

Typedefs

typedef struct PDDictionaryStackPDDictionaryStackRef
 

Functions

PDDictionaryStackRef PDDictionaryStackCreateWithDictionary (PDDictionaryRef dict)
 
void PDDictionaryStackPushDictionary (PDDictionaryStackRef ds, PDDictionaryRef dict)
 
PDDictionaryRef PDDictionaryStackPopDictionary (PDDictionaryStackRef ds)
 
void PDDictionaryStackAddEntriesFromComplex (PDDictionaryStackRef hm, pd_stack stack)
 
void PDDictionaryStackSet (PDDictionaryStackRef ds, const char *key, void *value)
 
void * PDDictionaryStackGet (PDDictionaryStackRef ds, const char *key)
 
void PDDictionaryStackDelete (PDDictionaryStackRef ds, const char *key)
 
void PDDictionaryStackClear (PDDictionaryStackRef ds)
 
void PDDictionaryStackIterate (PDDictionaryStackRef ds, PDHashIterator it, void *ui)
 

Detailed Description

A stack of dictionaries.

PDDictionaryStack is a special purpose dictionary implementation which is used to access a stack of dictionaries.

The dictionaries are located in a regular stack. Only the top-most stack is affected by changes, including entry deletions, dictionary clears, etc.

When polling a dictionary for a given key, the stack is traversed until a dictionary is encountered whose value for the given key is non-NULL. This value is returned.

The implementation allows for "modifications" to master dictionaries, such as the latin encoding dictionary, modified by Differences arrays in an Encoding dictionary.

Typedef Documentation

A dictionary stack implementation.

The dictionary stack construct.

Function Documentation

void PDDictionaryStackAddEntriesFromComplex ( PDDictionaryStackRef  hm,
pd_stack  stack 
)

Add all entries from the given PDF dictionary stack to the top dictionary. Entries will replace pre-existing key/value pairs when a key in the pd_stack matches the key in the dictionary.

Parameters
dsDictionary to add entries to
stackPDF dictionary stack
void PDDictionaryStackClear ( PDDictionaryStackRef  ds)

Remove all entries in the top dictionary.

Parameters
dsDictionary to clear
PDDictionaryStackRef PDDictionaryStackCreateWithDictionary ( PDDictionaryRef  dict)

Create a new dictionary stack with the given dictionary as the initial dictionary.

Parameters
dictInitial dictionary
Returns
A new dictionary stack
void PDDictionaryStackDelete ( PDDictionaryStackRef  ds,
const char *  key 
)

Delete the given key from the top dictionary.

Parameters
dsThe dictionary stack
keyThe key to delete
void* PDDictionaryStackGet ( PDDictionaryStackRef  ds,
const char *  key 
)

Get the value of the given key.

Parameters
dsThe dictionary stack
keyThe key
void PDDictionaryStackIterate ( PDDictionaryStackRef  ds,
PDHashIterator  it,
void *  ui 
)

Iterate over the dictionary stack entries using the given iterator.

Parameters
dsThe dictionary stack whose dictionaries should be iterated
itThe iterating function
uiUser information to pass to iterator, if any
PDDictionaryRef PDDictionaryStackPopDictionary ( PDDictionaryStackRef  ds)

Pop the topmost dictionary from the dictionary stack.

Parameters
dsDictionary stack
Returns
The topmost dictionary, or NULL if the dictionary stack is empty
void PDDictionaryStackPushDictionary ( PDDictionaryStackRef  ds,
PDDictionaryRef  dict 
)

Push the given dictionary on top of the dictionary stack.

Parameters
dsDictionary stack
dictDictionary to push
void PDDictionaryStackSet ( PDDictionaryStackRef  ds,
const char *  key,
void *  value 
)

Set key to value. If value is NULL, an assertion is thrown. To delete keys, use PDDictionaryDelete().

Parameters
dsThe dictionary stack
keyThe key
valueThe value