| ## Public API Reference

- Main Page
- Modules
- Namespaces
- Classes
- Files
- Related Pages

- File List
- File Members

# iutil/cfgfile.h

Go to the documentation of this file.

    00001 /*
    00002     Copyright (C) 2001 by Martin Geisse <mgeisse@gmx.net>
    00003
    00004     This library is free software; you can redistribute it and/or
    00005     modify it under the terms of the GNU Library General Public
    00006     License as published by the Free Software Foundation; either
    00007     version 2 of the License, or (at your option) any later version.
    00008
    00009     This library is distributed in the hope that it will be useful,
    00010     but WITHOUT ANY WARRANTY; without even the implied warranty of
    00011     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    00012     Library General Public License for more details.
    00013
    00014     You should have received a copy of the GNU Library General Public
    00015     License along with this library; if not, write to the Free
    00016     Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
    00017 */
    00018
    00019 #ifndef __CS_IUTIL_CFGFILE_H__
    00020 #define __CS_IUTIL_CFGFILE_H__
    00021
    00027 #include "csutil/scf_interface.h"
    00028 #include "csutil/ref.h"
    00029
    00030 struct iConfigIterator;
    00031 struct iVFS;
    00032
    00036 struct iConfigFile : public virtual iBase
    00037 {
    00038   SCF_INTERFACE(iConfigFile, 2,0,0);
    00040   virtual const char* GetFileName () const = 0;
    00041
    00046   virtual iVFS* GetVFS () const = 0;
    00047
    00052   virtual void SetFileName (const char*, iVFS*) = 0;
    00053
    00069   virtual bool Load (const char* iFileName, iVFS* = 0, bool Merge = false,
    00070     bool NewWins = true) = 0;
    00071
    00076   virtual bool Save () = 0;
    00077
    00084   virtual bool Save (const char *iFileName, iVFS* = 0) = 0;
    00085
    00087   virtual void Clear () = 0;
    00088
    00095   virtual csPtr<iConfigIterator> Enumerate (const char *Subsection = 0) = 0;
    00096
    00098   virtual bool KeyExists (const char *Key) const = 0;
    00100   virtual bool SubsectionExists (const char *Subsection) const = 0;
    00101
    00106   virtual int GetInt (const char *Key, int Def = 0) const = 0;
    00111   virtual float GetFloat (const char *Key, float Def = 0.0) const = 0;
    00116   virtual const char *GetStr (const char *Key, const char *Def = "") const = 0;
    00121   virtual bool GetBool (const char *Key, bool Def = false) const = 0;
    00123   virtual const char *GetComment (const char *Key) const = 0;
    00124
    00126   virtual void SetStr (const char *Key, const char *Val) = 0;
    00128   virtual void SetInt (const char *Key, int Value) = 0;
    00130   virtual void SetFloat (const char *Key, float Value) = 0;
    00132   virtual void SetBool (const char *Key, bool Value) = 0;
    00139   virtual bool SetComment (const char *Key, const char *Text) = 0;
    00141   virtual void DeleteKey (const char *Key) = 0;
    00143   virtual const char *GetEOFComment () const = 0;
    00145   virtual void SetEOFComment (const char *Text) = 0;
    00146 };
    00147
    00148
    00153 struct iConfigIterator : public virtual iBase
    00154 {
    00155   SCF_INTERFACE(iConfigIterator, 2,1,0);
    00157   virtual iConfigFile *GetConfigFile () const = 0;
    00159   virtual const char *GetSubsection () const = 0;
    00160
    00162   virtual void Rewind () = 0;
    00164   virtual bool Next() = 0;
    00166   virtual bool HasNext() = 0;
    00167
    00168
    00175   virtual const char *GetKey (bool Local = false) const = 0;
    00177   virtual int GetInt () const = 0;
    00179   virtual float GetFloat () const = 0;
    00181   virtual const char *GetStr () const = 0;
    00183   virtual bool GetBool () const = 0;
    00185   virtual const char *GetComment () const = 0;
    00186 };
    00189 #endif // __CS_IUTIL_CFGFILE_H__