CrystalSpace

Public API Reference

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

cfgmgr.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_CFGMGR_H__
00020 #define __CS_CFGMGR_H__
00021 
00026 #include "csextern.h"
00027 #include "iutil/cfgmgr.h"
00028 #include "refarr.h"
00029 #include "array.h"
00030 
00036 class CS_CSUTIL_EXPORT csConfigManager : public iConfigManager
00037 {
00038 public:
00039   SCF_DECLARE_IBASE;
00040 
00056   csConfigManager(iConfigFile *DynamicDomain = 0, bool Optimize = false);
00058   virtual ~csConfigManager();
00059 
00064   virtual void AddDomain(iConfigFile*, int priority);
00074   virtual iConfigFile* AddDomain(char const* path, iVFS*, int priority);
00082   virtual void RemoveDomain(iConfigFile*);
00084   virtual void RemoveDomain(char const* path);
00089   virtual iConfigFile* LookupDomain(char const* path) const;
00091   virtual void SetDomainPriority(char const* path, int priority);
00096   virtual void SetDomainPriority(iConfigFile*, int priority);
00101   virtual int GetDomainPriority(char const* path) const;
00106   virtual int GetDomainPriority(iConfigFile*) const;
00107 
00113   virtual bool SetDynamicDomain(iConfigFile*);
00119   virtual iConfigFile *GetDynamicDomain() const;
00121   virtual void SetDynamicDomainPriority(int priority);
00123   virtual int GetDynamicDomainPriority() const;
00124 
00126   virtual void FlushRemoved();
00127 
00132   virtual const char* GetFileName () const;
00133 
00138   virtual iVFS* GetVFS () const;
00139 
00146   virtual void SetFileName (const char*, iVFS*);
00147 
00164   virtual bool Load (const char* iFileName, iVFS* = 0, bool Merge = false,
00165     bool NewWins = true);
00166 
00171   virtual bool Save ();
00172 
00179   virtual bool Save (const char *iFileName, iVFS* = 0);
00180 
00182   virtual void Clear ();
00183 
00185   void CleanUp ();
00186 
00193   virtual csPtr<iConfigIterator> Enumerate(const char *Subsection = 0);
00194 
00196   virtual bool KeyExists(const char *Key) const;
00198   virtual bool SubsectionExists(const char *Subsection) const;
00199 
00201   virtual int GetInt(const char *Key, int Def = 0) const;
00203   virtual float GetFloat(const char *Key, float Def = 0.0) const;
00205   virtual const char *GetStr(const char *Key, const char *Def = "") const;
00207   virtual bool GetBool(const char *Key, bool Def = false) const;
00209   virtual const char *GetComment(const char *Key) const;
00210 
00212   virtual void SetStr (const char *Key, const char *Val);
00214   virtual void SetInt (const char *Key, int Value);
00216   virtual void SetFloat (const char *Key, float Value);
00218   virtual void SetBool (const char *Key, bool Value);
00225   virtual bool SetComment (const char *Key, const char *Text);
00227   virtual void DeleteKey(const char *Key);
00229   virtual const char *GetEOFComment() const;
00231   virtual void SetEOFComment(const char *Text);
00232 
00233 private:
00234   friend class csConfigManagerIterator;
00236   bool Optimize;
00238   class csConfigDomain *DynamicDomain;
00240   class csConfigDomain *FirstDomain, *LastDomain;
00242   csRefArray<iConfigFile> Removed;
00244   csArray<iConfigIterator*> Iterators;
00245 
00246   csConfigDomain *FindConfig(iConfigFile *cfg) const;
00247   csConfigDomain *FindConfig(const char *name) const;
00248   void ClearKeyAboveDynamic(const char *Key);
00249   void RemoveIterator(csConfigManagerIterator *it);
00250   void FlushRemoved(size_t n);
00251   size_t FindRemoved(const char *Filename) const;
00252   void RemoveDomain(class csConfigDomain *cfg);
00253 };
00254 
00255 #endif // __CS_CFGMGR_H__

Generated for Crystal Space by doxygen 1.3.9.1