- Inherits from:
- Object
- Conforms to:
- DConfigHandler
- Declared in:
- DConfig.h
Object
|
+---DConfigTree
Class Description
The Config class implements methods for storing config options,
including reading and writing to a config file, and changing and
removing options. Config options are structured in sections with
multiple options with values.
- Last modified:
- 31-Oct-2007 (DConfig.h)
Instance Variables
- private DTree *_config
- the options in a tree of sections
- private DTreeIterator *_iter
- the iterator in the config tree
- Constructors
- - (DConfigTree *) init
- Initialise a config tree
- Returns:
- the object
- - (DConfigTree *) init :(id <DTextReadable>) source :(const char *) name
- Initialise a config tree with a config source
- Parameters:
- source - the config source
filename - the name of the config source
- Returns:
- the object
- Copy constructor
- - shallowCopy
- Do a shallow copy of the object (not implemented)
- Returns:
- the object
- Deconstructor
- - free
- Free the object
- Returns:
- the object
- Config tree reading and writing
- - (BOOL) read :(id <DTextReadable>) source :(const char *) name
- Read the config from a source
- Parameters:
- source - the source of the config
name - the name of the source
- Returns:
- success
- - (BOOL) write :(id <DTextWritable>) destination :(const char *) name
- Write the config to a destination
- Parameters:
- destination - the destination of the config
name - the name of the destination (not used)
- Returns:
- success
- Options methods
- - (const char *) get :(const char *) section :(const char *) option
- Get the value of a section,option
- Parameters:
- section - the section for the option
option - the option
- Returns:
- the value (or NULL)
- - (BOOL) has :(const char *) section
- Check if the config tree has a section
- Parameters:
- section - the section
- Returns:
- has it ?
- - (BOOL) has :(const char *) section :(const char *) option
- Check if the config tree has a section,option
- Parameters:
- section - the section
option - the option
- Returns:
- has it ?
- - (BOOL) remove :(const char *) section
- Remove a section (and all its options) from the config tree
- Parameters:
- section - the section
- Returns:
- success
- - (BOOL) remove :(const char *) section :(const char *) option
- Remove a section,option from the config tree
- Parameters:
- section - the section
option - the option
- Returns:
- success
- - (BOOL) set :(const char *) section :(const char *) option :(const char *) value
- Set the value for a section,option
- Parameters:
- section - the section for the option
option - the option
value - the value for the option
- Returns:
- success
- List methods
- - (DList *) options :(const char *) section
- Return a list with all the options in a section
- Parameters:
- section - the section for the opstions
- Returns:
- a (new) list with all the options (or nil for unkown section)
- - (DList *) sections
- Return a list with all the sections in the config tree
- Returns:
- a (new) list with all the sections
- Call back methods for the config parser (private)
- - (BOOL) comment :(const char *) comment
- Write a comment in the config file
- Parameters:
- comment - the comment text
- Returns:
- success
- - (BOOL) endConfig
- Process the end of the config file
- Returns:
- success
- - (void) error :(int) number :(const char *) name :(int) lineNumber :(int) columnNumber
- An error is found during the parsing of the file
- Parameters:
- number - the error number
name - the name of the config file
lineNumber - the line number in the config file
columnNumber - the column number in the config file
- Returns:
- success
- - (BOOL) option :(const char *) section :(const char *) option :(const char *) value
- Process an option
- Parameters:
- section - the name of the section
option - the name of the option
value - the value of the option
- Returns:
- success
- - (BOOL) section :(const char *) name
- Process the (start of a) section
- Parameters:
- name - the name of the section
- Returns:
- success
- - (BOOL) startConfig
- Process the start of the config file
- Returns:
- success
generated 05-Nov-2007 by ObjcDoc 3.0.0