LibJAD Dictionary Routines

#include "jaddict.h"

Overview

The LibJAD dictionary routines provide means to read an ini style file and query for its contents. Internally the key search is done using a binary search so as to enable the class to handle very large dictionaries.

Dictionary read_properties(char* filename)

filenameThe name of the file containing the dictionary.
returnThe dictionary stored in the given file.

This routine reads an ini style file and parses the contents into a dictionary object. The format of this file should be one key value pair per line, with the key and value separated by an equal sign. If there was a problem reading the file the size member of dictionary will be set to zero.

char** get_value_by_key(Dictionary dict, char* key)

dictThe dictionary to search.
keyThe key to retrieve from the dictionary.
returnA null terminated array of strings, or NULL if the key was not found.

Retrieves the given key from the dictionary, then splits it using commas (,) as the delimiter.

char** get_array_by_key(Dictionary dict, char* key)

dictThe dictionary to search.
keyThe key to retrieve from the dictionary.
returnA null terminated array of strings, or NULL if the key was not found.

Retrieves the given key from the dictionary, as a null terminated string.

void free_dictionary(Dictionary dict)

dictThe dictionary to be freed

Frees the memory used by a given dictionary. Should be called before the dictionary object goes out of scope.