Main Page   File List   File Members  

tucs.h File Reference

Go to the source code of this file.

Defines

#define TUCS   "0.1.15"
#define TUCS_BADSETTING   NULL

Typedefs

typedef struct setting* tucs_setting
typedef unsigned char tucs_bool

Enumerations

enum  tucs_type {
  TypeGeneric = 1, TypeString = 2, TypeInt = 3, TypeDouble = 4,
  TypeBool = 5, TypeGroup = 10, TypeList = 11
}
enum  tucs_errors {
  OK, EOutOfMem, EWrongType, ENotGroup,
  EIsGroup, EInvalidSetting, ENoParentGroup
}
enum  tucs_syncMode { SyncImmediate = 1, SyncOnCommand = 2 }
enum  tucs_metaconfigMode { MetaNever = 1, MetaIfMissing = 2, MetaIfRootMissing = 3 }

Functions

int tucs_init (const char *base_path)
tucs_setting tucs_declareStringSetting (const char *name, const char *defval, const char *sdesc, int flags)
tucs_setting tucs_declareIntSetting (const char *name, int defval, const char *sdesc, int flags)
tucs_setting tucs_declareDoubleSetting (const char *name, double defval, const char *sdesc, int flags)
tucs_setting tucs_declareBoolSetting (const char *name, tucs_bool defval, const char *sdesc, int flags)
tucs_setting tucs_getSetting (const char *name)
tucs_setting tucs_getGroupHandle (const char *base_path)
const char* tucs_getStringValue (tucs_setting setting)
int tucs_getIntValue (tucs_setting setting)
const char* tucs_getStringValueByName (const char *name, const char *defval)
int tucs_getIntValueByName (const char *name, int defval)
int tucs_setStringValue (tucs_setting setting, const char *newval)
int tucs_setIntValue (tucs_setting setting, int newval)
int tucs_setDoubleValue (tucs_setting setting, double newval)
int tucs_setBoolValue (tucs_setting setting, tucs_bool newval)
int tucs_setStringValueByName (const char *name, const char *newval)
int tucs_setIntValueByName (const char *name, int newval)
int tucs_setDoubleValueByName (const char *name, double newval)
int tucs_setBoolValueByName (const char *name, tucs_bool newval)
int tucs_setSettingDefault (tucs_setting setting)
const char* tucs_getName (const tucs_setting setting)
const char* tucs_getPath (const tucs_setting setting)
const char* tucs_getPrefix (const tucs_setting setting)
const char* tucs_getDescription (const tucs_setting setting)
tucs_type tucs_getType (const tucs_setting setting)
tucs_setting tucs_setBase (const char *base_path)
int tucs_setSearchOrder (const char *searchlist)
int tucs_setSyncMode (tucs_syncMode syncMode)
int tucs_setMetaconfigMode (tucs_metaconfigMode mode)
tucs_setting tucs_getGroupFirst (tucs_setting group)
tucs_setting tucs_getGroupNext (tucs_setting group)
tucs_setting tucs_getMetaGroup (const tucs_setting set)
tucs_setting tucs_getMetaGroupByName (const char *pathname)
tucs_setting tucs_recreateMetaGroup (const tucs_setting set)
int tucs_commit (void)
void tucs_commitSetting (tucs_setting setting)
void tucs_close (void)
char* tucs_getCurrentUser (void)
void tucs_debugWrite (void)

Variables

tucs_errors tucs_error


Define Documentation

#define TUCS   "0.1.15"
 

TUCS version definition. This symbol can be used to test the for presense of Tucs.

#define TUCS_BADSETTING   NULL
 

A special handle, used to represent error.


Typedef Documentation

typedef unsigned char tucs_bool
 

Shortcut for boolean.

typedef struct setting * tucs_setting
 

A locator is a "."-separated path like "main.window.width", used for the name of a setting.

This API is oriented toward C and other languages that do not have polymorphic functions. Languages that do have polymorphic functions only need one function instead of functions sets.

String is "char *" in C, more appropriate types in other languages. Bool is "unsigned char" in C, more appropriate types in other languages. <type> is one of "string", "int", "double", or "tucs_bool". <Type> is one of "String", "Int", "Double", or "Bool".

Settings and setting groups are referred to by using 'handles'. Internally, they are pointers, to non-public setting structures.

A setting handle is used to refer to a setting. Internally it is a pointer to a setting structure.


Enumeration Type Documentation

enum tucs_errors
 

Error vlaues.

Enumeration values:
OK  
EOutOfMem  
EWrongType  
ENotGroup  
EIsGroup  
EInvalidSetting  
ENoParentGroup  

enum tucs_metaconfigMode
 

Meta-config creation modes.

Enumeration values:
MetaNever  
MetaIfMissing  
MetaIfRootMissing  

enum tucs_syncMode
 

Synchronization modes.

Enumeration values:
SyncImmediate  
SyncOnCommand  

enum tucs_type
 

Setting types. Generic means that we don't know the type yet.

Enumeration values:
TypeGeneric   simple settings
TypeString  
TypeInt  
TypeDouble  
TypeBool  
TypeGroup  
TypeList  


Function Documentation

void tucs_close ( void )
 

Commit changes and close config.

int tucs_commit ( void )
 

This function flushes the buffers associated with the group. It is called automatically.

void tucs_commitSetting ( tucs_setting setting )
 

This function commits the changes of setting/group. If changed, values will be passed to the storage layer. Note that the storage layer can have its own buffering.

void tucs_debugWrite ( void )
 

Write out all settings to stdout

tucs_setting tucs_declareBoolSetting ( const char * name,
tucs_bool defval,
const char * sdesc,
int flags )
 

Add a boolean setting to the current group

tucs_setting tucs_declareDoubleSetting ( const char * name,
double defval,
const char * sdesc,
int flags )
 

Add a double setting to the current group

tucs_setting tucs_declareIntSetting ( const char * name,
int defval,
const char * sdesc,
int flags )
 

Add an integer setting to the current group

tucs_setting tucs_declareStringSetting ( const char * name,
const char * defval,
const char * sdesc,
int flags )
 

Add a string setting to the current group.

char * tucs_getCurrentUser ( void )
 

Get the login ID of the current user.

const char * tucs_getDescription ( const tucs_setting setting )
 

Return description

tucs_setting tucs_getGroupFirst ( tucs_setting group )
 

Set the current value of a group to its first element.

tucs_setting tucs_getGroupHandle ( const char * base_path )
 

Returns a handle to a group, create if needed.

tucs_setting tucs_getGroupNext ( tucs_setting group )
 

Set the current value of a group to its next element.

int tucs_getIntValue ( tucs_setting setting )
 

int tucs_getIntValueByName ( const char * name,
int defval )
 

tucs_setting tucs_getMetaGroup ( const tucs_setting set )
 

Return the setting handle of the meta group corresponding to this setting, if it exists.

tucs_setting tucs_getMetaGroupByName ( const char * pathname )
 

Return the setting handle of the meta group corresponding to this setting name, if it exists.

const char * tucs_getName ( const tucs_setting setting )
 

Return name of setting

const char * tucs_getPath ( const tucs_setting setting )
 

Return the full path of setting

const char * tucs_getPrefix ( const tucs_setting setting )
 

Get the prefix used in the last operation.

tucs_setting tucs_getSetting ( const char * name )
 

This function is used to get only existing settings from the configuration. If a setting doesn't exist, an error is returned. This function is useful for probing tucs to see what settings are there in case you don't know the structure of the configuration.

const char * tucs_getStringValue ( tucs_setting setting )
 

Get value of a setting.

const char * tucs_getStringValueByName ( const char * name,
const char * defval )
 

Get value of a setting, using its name

tucs_type tucs_getType ( const tucs_setting setting )
 

Return type

int tucs_init ( const char * base_path )
 

Initialize tucs, and open a configuration. Return an error code.

tucs_setting tucs_recreateMetaGroup ( const tucs_setting set )
 

Regenerate meta-setting for the setting. Returns a handle to the meta-setting group.

tucs_setting tucs_setBase ( const char * base_path )
 

This function sets the base path of the configuration/group used. It inlcudes a base path but no prefix. Example: "app.editor" Returns a handle to the group.

int tucs_setBoolValue ( tucs_setting setting,
tucs_bool newval )
 

int tucs_setBoolValueByName ( const char * name,
tucs_bool newval )
 

int tucs_setDoubleValue ( tucs_setting setting,
double newval )
 

int tucs_setDoubleValueByName ( const char * name,
double newval )
 

int tucs_setIntValue ( tucs_setting setting,
int newval )
 

int tucs_setIntValueByName ( const char * name,
int newval )
 

int tucs_setMetaconfigMode ( tucs_metaconfigMode mode )
 

Set meta-config generation mode. Default is MetaIfRootMissing

int tucs_setSearchOrder ( const char * searchlist )
 

Set the search order of prefixes. Example: tucs_setSearchOrder ("global") Default search order is "user.current:global".

int tucs_setSettingDefault ( tucs_setting setting )
 

Set value to default value

int tucs_setStringValue ( tucs_setting setting,
const char * newval )
 

Set value of a setting, using a handle

int tucs_setStringValueByName ( const char * name,
const char * newval )
 

Set value of a setting, using its name.

int tucs_setSyncMode ( tucs_syncMode syncMode )
 

Set synchronization mode


Variable Documentation

tucs_errors tucs_error
 

Global variable holding the last error value.


Generated at Wed Feb 28 23:05:54 2001 for TUCS by doxygen1.2.5 written by Dimitri van Heesch, © 1997-2001