Google

Main Page   Class Hierarchy   Compound List   File List   Compound Members  

iConfigFile Struct Reference

Configuration file interface. More...

#include <cfgfile.h>

Inheritance diagram for iConfigFile:

iBase csConfigFile iConfigManager csPrefixConfig csConfigManager List of all members.

Public Methods

virtual const char* GetFileName () const=0
 Get configuration file name. More...

virtual iVFSGetVFS () const=0
 Get the VFS object on which this file is stored (if any). More...

virtual void SetFileName (const char *, iVFS *)=0
 Set config file name. More...

virtual bool Load (const char *iFileName, iVFS *=NULL, bool Merge=false, bool NewWins=true)=0
 Load a configuration file. More...

virtual bool Save ()=0
 Save configuration to the same place from which it was loaded. More...

virtual bool Save (const char *iFileName, iVFS *=NULL)=0
 Save configuration into the given file (on VFS or on the physical filesystem). More...

virtual void Clear ()=0
 Delete all options and rewind all iterators.

virtual iConfigIteratorEnumerate (const char *Subsection=NULL)=0
 Enumerate selected keys. More...

virtual bool KeyExists (const char *Key) const=0
 Test if a key exists.

virtual bool SubsectionExists (const char *Subsection) const=0
 Test if at least one key exists with the given Subsection prefix.

virtual int GetInt (const char *Key, int Def=0) const=0
 Get an integer value from the configuration.

virtual float GetFloat (const char *Key, float Def=0.0) const=0
 Get a float value from the configuration.

virtual const char* GetStr (const char *Key, const char *Def="") const=0
 Get a string value from the configuration.

virtual bool GetBool (const char *Key, bool Def=false) const=0
 Get a boolean value from the configuration.

virtual const char* GetComment (const char *Key) const=0
 Get the comment of the given key, or NULL if no comment exists.

virtual void SetStr (const char *Key, const char *Val)=0
 Set an null-terminated string value.

virtual void SetInt (const char *Key, int Value)=0
 Set an integer value.

virtual void SetFloat (const char *Key, float Value)=0
 Set a floating-point value.

virtual void SetBool (const char *Key, bool Value)=0
 Set a boolean value.

virtual bool SetComment (const char *Key, const char *Text)=0
 Set the comment for given key. More...

virtual void DeleteKey (const char *Key)=0
 Delete a key and its value and comment.

virtual const char* GetEOFComment () const=0
 return the final comment at the end of the configuration file.

virtual void SetEOFComment (const char *Text)=0
 set the final comment at the end of the configuration file.


Detailed Description

Configuration file interface.


Member Function Documentation

iConfigIterator * iConfigFile::Enumerate ( const char * Subsection = NULL ) [pure virtual]
 

Enumerate selected keys.

If a subsection is given, only those keys which are prefixed by the subsection string will be enumerated. The returned iterator does not yet point to a valid key. You must call Next() to set it to the first key.

Reimplemented in csConfigFile, and csConfigManager.

const char * iConfigFile::GetFileName ( ) const [pure virtual]
 

Get configuration file name.

Also consult GetVFS() to determine which (if any) VFS object was used for the file's storage.

Reimplemented in csConfigFile, and csConfigManager.

iVFS * iConfigFile::GetVFS ( ) const [pure virtual]
 

Get the VFS object on which this file is stored (if any).

Returns NULL if this file resides within the real (non-VFS) filesystem.

Reimplemented in csConfigFile, and csConfigManager.

bool iConfigFile::Load ( const char * iFileName,
iVFS * = NULL,
bool Merge = false,
bool NewWins = true ) [pure virtual]
 

Load a configuration file.

If the file resides in a real filesystem, rather than a VFS filesystem, then pass NULL for the VFS argument. This will clear all options before loading the new options, even if the file cannot be opened.

You can set the Merge flag to merge the newly loaded configuration information into the existing information. If you do so, nothing will happen if the named file doesn't exist. The NewWins flag determines the behavior in case of configuration key conflicts. If true, then the new configuration value replaces the old for that key. If false, then the old value is kept, and the new value is ignored. The recorded file name will be set to the name of the newly loaded file if the Merge flag is false; otherwise it will retain the old name.

Reimplemented in csConfigFile, and csConfigManager.

bool iConfigFile::Save ( const char * iFileName,
iVFS * = NULL ) [pure virtual]
 

Save configuration into the given file (on VFS or on the physical filesystem).

If the second parameter is skipped, the file will be written to the physical filesystem, otherwise it is stored on given VFS filesystem. This method does not change the internally stored file name.

Reimplemented in csConfigFile, and csConfigManager.

bool iConfigFile::Save ( ) [pure virtual]
 

Save configuration to the same place from which it was loaded.

Returns true if the save operation succeeded.

Reimplemented in csConfigFile, and csConfigManager.

bool iConfigFile::SetComment ( const char * Key,
const char * Text ) [pure virtual]
 

Set the comment for given key.

In addition to an actual comment, you can use "" for Text to place an empty comment line before this key, or NULL to remove the comment entirely. The comment may contain newline characters. Returns false if the key does not exist.

Reimplemented in csConfigFile, and csConfigManager.

void iConfigFile::SetFileName ( const char *,
iVFS * ) [pure virtual]
 

Set config file name.

You can use this if you want Save() to write to another file. This will set the dirty flag.

Reimplemented in csConfigFile, and csConfigManager.


The documentation for this struct was generated from the following file:
Generated for Crystal Space by doxygen 1.2.5 written by Dimitri van Heesch, ©1997-2000