CrystalSpace

Public API Reference

Main Page   Modules   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages  

cfgmgr.h

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_CFGMGR_H__
00020 #define __CS_CFGMGR_H__
00021 
00022 #include "iutil/cfgmgr.h"
00023 #include "csutil/refarr.h"
00024 #include "csutil/array.h"
00025 
00031 class csConfigManager : public iConfigManager
00032 {
00033 public:
00034   SCF_DECLARE_IBASE;
00035 
00049   csConfigManager(iConfigFile *DynamicDomain, bool Optimize);
00051   virtual ~csConfigManager();
00052 
00054   virtual void AddDomain(iConfigFile*, int priority);
00056   virtual iConfigFile *AddDomain(char const* path, iVFS*, int priority);
00058   virtual void RemoveDomain(iConfigFile*);
00060   virtual void RemoveDomain(char const* path);
00062   virtual iConfigFile* LookupDomain(char const* path) const;
00064   virtual void SetDomainPriority(char const* path, int priority);
00066   virtual void SetDomainPriority(iConfigFile*, int priority);
00068   virtual int GetDomainPriority(char const* path) const;
00070   virtual int GetDomainPriority(iConfigFile*) const;
00071 
00076   virtual bool SetDynamicDomain(iConfigFile*);
00078   virtual iConfigFile *GetDynamicDomain() const;
00080   virtual void SetDynamicDomainPriority(int priority);
00082   virtual int GetDynamicDomainPriority() const;
00083 
00085   virtual void FlushRemoved();
00086 
00091   virtual const char* GetFileName () const;
00092 
00097   virtual iVFS* GetVFS () const;
00098 
00103   virtual void SetFileName (const char*, iVFS*);
00104 
00121   virtual bool Load (const char* iFileName, iVFS* = 0, bool Merge = false,
00122     bool NewWins = true);
00123 
00128   virtual bool Save ();
00129 
00136   virtual bool Save (const char *iFileName, iVFS* = 0);
00137 
00139   virtual void Clear ();
00140 
00144   void CleanUp ();
00145 
00152   virtual csPtr<iConfigIterator> Enumerate(const char *Subsection = 0);
00153 
00155   virtual bool KeyExists(const char *Key) const;
00157   virtual bool SubsectionExists(const char *Subsection) const;
00158 
00160   virtual int GetInt(const char *Key, int Def = 0) const;
00162   virtual float GetFloat(const char *Key, float Def = 0.0) const;
00164   virtual const char *GetStr(const char *Key, const char *Def = "") const;
00166   virtual bool GetBool(const char *Key, bool Def = false) const;
00168   virtual const char *GetComment(const char *Key) const;
00169 
00171   virtual void SetStr (const char *Key, const char *Val);
00173   virtual void SetInt (const char *Key, int Value);
00175   virtual void SetFloat (const char *Key, float Value);
00177   virtual void SetBool (const char *Key, bool Value);
00184   virtual bool SetComment (const char *Key, const char *Text);
00186   virtual void DeleteKey(const char *Key);
00188   virtual const char *GetEOFComment() const;
00190   virtual void SetEOFComment(const char *Text);
00191 
00192 private:
00193   friend class csConfigManagerIterator;
00195   bool Optimize;
00197   class csConfigDomain *DynamicDomain;
00199   class csConfigDomain *FirstDomain, *LastDomain;
00201   csRefArray<iConfigFile> Removed;
00203   csArray<iConfigIterator*> Iterators;
00204 
00205   csConfigDomain *FindConfig(iConfigFile *cfg) const;
00206   csConfigDomain *FindConfig(const char *name) const;
00207   void ClearKeyAboveDynamic(const char *Key);
00208   void RemoveIterator(csConfigManagerIterator *it);
00209   void FlushRemoved(int n);
00210   int FindRemoved(const char *Filename) const;
00211   void RemoveDomain(class csConfigDomain *cfg);
00212 };
00213 
00214 #endif // __CS_CFGMGR_H__

Generated for Crystal Space by doxygen 1.2.14