Home Download Musics Developers
API Sources Tools File Format Technicals

configuration file
[api68 library documentation.]


Detailed Description

This module prodives functions to access sc68 configuration file.


Typedefs

typedef _SC68config_s SC68config_t
 Config.


Enumerations

enum  SC68config_type_t { SC68CONFIG_UNDEFINED = 0, SC68CONFIG_INT, SC68CONFIG_STRING, SC68CONFIG_ERROR = -1 }
 Config entry types. More...


Functions

int SC68config_valid (SC68config_t *conf)
 Check and correct config values.

int SC68config_get_idx (const SC68config_t *conf, const char *name)
 Get index of named config entry.

SC68config_type_t SC68config_range (const SC68config_t *conf, int idx, int *min, int *max, int *def)
 Get type and range of a config entry.

SC68config_type_t SC68config_get (const SC68config_t *conf, int *v, const char **name)
 Get value of a config entry.

SC68config_type_t SC68config_set (SC68config_t *conf, int idx, const char *name, int v, const char *s)
 Set value of a config entry.

int SC68config_load (SC68config_t *conf)
 Load config from file.

int SC68config_save (SC68config_t *conf)
 Save config into file.

int SC68config_default (SC68config_t *conf)
 Fill config struct with default value.

SC68config_tSC68config_create (int size)
 Create config.

void SC68config_destroy (SC68config_t *conf)
 Destroy config.


Enumeration Type Documentation

enum SC68config_type_t
 

Config entry types.

Enumeration values:
SC68CONFIG_INT  Value is not set.
SC68CONFIG_STRING  Value is an integer.
SC68CONFIG_ERROR  Value is a string.


Function Documentation

int SC68config_get_idx const SC68config_t conf,
const char *  name
 

Get index of named config entry.

Parameters:
conf config.
name name of entry.
Returns:
index
Return values:
-1 error

SC68config_type_t SC68config_range const SC68config_t conf,
int  idx,
int *  min,
int *  max,
int *  def
 

Get type and range of a config entry.

Parameters:
conf config.
idx index.
min store min value (0 ignore).
max store max value (0 ignore).
def store default value (0 ignore).
Returns:
type of config entry
Return values:
SC68CONFIG_ERROR on error

SC68config_type_t SC68config_get const SC68config_t conf,
int *  v,
const char **  name
 

Get value of a config entry.

Parameters:
conf config.
v input: pointer to index; output: integer value or unmodified.
name input: pointer to name; output: string value or unmodified.
Returns:
type of config entry
Return values:
SC68CONFIG_ERROR on error

SC68config_type_t SC68config_set SC68config_t conf,
int  idx,
const char *  name,
int  v,
const char *  s
 

Set value of a config entry.

Parameters:
conf config.
idx index of config entry used only if name not found.
name pointer to name (0:use idx).
v value used to set SC68CONFIG_INT entry.
s value used to set SC68CONFIG_STRING entry.
Returns:
type of config entry
Return values:
SC68CONFIG_ERROR on error