CrystalSpace

Public API Reference

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

csutil/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 "refarr.h"
00024 #include "array.h"
00025 
00031 class csConfigManager : public iConfigManager
00032 {
00033 public:
00034   SCF_DECLARE_IBASE;
00035 
00051   csConfigManager(iConfigFile *DynamicDomain, bool Optimize);
00053   virtual ~csConfigManager();
00054 
00059   virtual void AddDomain(iConfigFile*, int priority);
00069   virtual iConfigFile* AddDomain(char const* path, iVFS*, int priority);
00077   virtual void RemoveDomain(iConfigFile*);
00079   virtual void RemoveDomain(char const* path);
00084   virtual iConfigFile* LookupDomain(char const* path) const;
00086   virtual void SetDomainPriority(char const* path, int priority);
00091   virtual void SetDomainPriority(iConfigFile*, int priority);
00096   virtual int GetDomainPriority(char const* path) const;
00101   virtual int GetDomainPriority(iConfigFile*) const;
00102 
00108   virtual bool SetDynamicDomain(iConfigFile*);
00114   virtual iConfigFile *GetDynamicDomain() const;
00116   virtual void SetDynamicDomainPriority(int priority);
00118   virtual int GetDynamicDomainPriority() const;
00119 
00121   virtual void FlushRemoved();
00122 
00127   virtual const char* GetFileName () const;
00128 
00133   virtual iVFS* GetVFS () const;
00134 
00141   virtual void SetFileName (const char*, iVFS*);
00142 
00159   virtual bool Load (const char* iFileName, iVFS* = 0, bool Merge = false,
00160     bool NewWins = true);
00161 
00166   virtual bool Save ();
00167 
00174   virtual bool Save (const char *iFileName, iVFS* = 0);
00175 
00177   virtual void Clear ();
00178 
00180   void CleanUp ();
00181 
00188   virtual csPtr<iConfigIterator> Enumerate(const char *Subsection = 0);
00189 
00191   virtual bool KeyExists(const char *Key) const;
00193   virtual bool SubsectionExists(const char *Subsection) const;
00194 
00196   virtual int GetInt(const char *Key, int Def = 0) const;
00198   virtual float GetFloat(const char *Key, float Def = 0.0) const;
00200   virtual const char *GetStr(const char *Key, const char *Def = "") const;
00202   virtual bool GetBool(const char *Key, bool Def = false) const;
00204   virtual const char *GetComment(const char *Key) const;
00205 
00207   virtual void SetStr (const char *Key, const char *Val);
00209   virtual void SetInt (const char *Key, int Value);
00211   virtual void SetFloat (const char *Key, float Value);
00213   virtual void SetBool (const char *Key, bool Value);
00220   virtual bool SetComment (const char *Key, const char *Text);
00222   virtual void DeleteKey(const char *Key);
00224   virtual const char *GetEOFComment() const;
00226   virtual void SetEOFComment(const char *Text);
00227 
00228 private:
00229   friend class csConfigManagerIterator;
00231   bool Optimize;
00233   class csConfigDomain *DynamicDomain;
00235   class csConfigDomain *FirstDomain, *LastDomain;
00237   csRefArray<iConfigFile> Removed;
00239   csArray<iConfigIterator*> Iterators;
00240 
00241   csConfigDomain *FindConfig(iConfigFile *cfg) const;
00242   csConfigDomain *FindConfig(const char *name) const;
00243   void ClearKeyAboveDynamic(const char *Key);
00244   void RemoveIterator(csConfigManagerIterator *it);
00245   void FlushRemoved(int n);
00246   int FindRemoved(const char *Filename) const;
00247   void RemoveDomain(class csConfigDomain *cfg);
00248 };
00249 
00250 #endif // __CS_CFGMGR_H__

Generated for Crystal Space by doxygen 1.2.18