Main Page | Data Structures | Directories | File List | Data Fields | Globals | Related Pages

ccl.h File Reference

The ccl library interface. More...

#include "ccl/bst.h"

Go to the source code of this file.

Functions

int ccl_parse (struct ccl_t *data, const char *path)
 Parse a configuration file.
void ccl_release (struct ccl_t *data)
 Release memory associated with a configuration file.
const char * ccl_get (const struct ccl_t *data, const char *key)
 Extract a value from a configuration file.
const struct ccl_pair_tccl_iterate (struct ccl_t *data)
 Iterate through all key/value pairs in a configuration file.
void ccl_reset (struct ccl_t *data)
 Reset a configuration file iterator.


Detailed Description

The ccl library interface.


Function Documentation

const char* ccl_get const struct ccl_t data,
const char *  key
 

Extract a value from a configuration file.

This function searches the parsed configuration file data for key, and returns the value associated with that key.
If key was found in the configuration file, the returned value will never be 0.
The value returned belongs to ccl, and should not be free'd.

Parameters:
data The ccl_t to query
key The key to query
Returns:
The value associated with key, or 0 if key was not found

const struct ccl_pair_t* ccl_iterate struct ccl_t data  ) 
 

Iterate through all key/value pairs in a configuration file.

This function allows iteration through all key/value pairs in a configuration file.
This function maintains internal state; to reset the iterator call ccl_reset.
The value returned belongs to ccl, and should not be free'd.

Parameters:
data The ccl_t to query
Returns:
A key/value pair, or 0 if no more exist in data

int ccl_parse struct ccl_t data,
const char *  path
 

Parse a configuration file.

This function will attempt to parse the configuration file path, using the comment, separator, and quote characters specified in data. This function allocates memory; use ccl_release to clean up.

Parameters:
data The ccl_t in which to store the parsed data
path The file to parse
Returns:
0 if successful, nonzero otherwise

void ccl_release struct ccl_t data  ) 
 

Release memory associated with a configuration file.

This function frees any dynamically-allocated memory in data.

Parameters:
data The ccl_t that is no longer needed

void ccl_reset struct ccl_t data  ) 
 

Reset a configuration file iterator.

This function resets the internal iterator in data to the first key/value pair.

Parameters:
data The ccl_t to reset


Generated on Fri Feb 25 15:09:15 2005 for ccl by  doxygen 1.4.1