Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | 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 "csutil/array.h" 00028 #include "csutil/refarr.h" 00029 #include "iutil/cfgmgr.h" 00030 00031 00032 class csConfigManagerIterator; 00033 00039 class CS_CRYSTALSPACE_EXPORT csConfigManager : public iConfigManager 00040 { 00041 public: 00042 SCF_DECLARE_IBASE; 00043 00059 csConfigManager(iConfigFile *DynamicDomain = 0, bool Optimize = false); 00061 virtual ~csConfigManager(); 00062 00067 virtual void AddDomain(iConfigFile*, int priority); 00077 virtual iConfigFile* AddDomain(char const* path, iVFS*, int priority); 00085 virtual void RemoveDomain(iConfigFile*); 00087 virtual void RemoveDomain(char const* path); 00092 virtual iConfigFile* LookupDomain(char const* path) const; 00094 virtual void SetDomainPriority(char const* path, int priority); 00099 virtual void SetDomainPriority(iConfigFile*, int priority); 00104 virtual int GetDomainPriority(char const* path) const; 00109 virtual int GetDomainPriority(iConfigFile*) const; 00110 00116 virtual bool SetDynamicDomain(iConfigFile*); 00122 virtual iConfigFile *GetDynamicDomain() const; 00124 virtual void SetDynamicDomainPriority(int priority); 00126 virtual int GetDynamicDomainPriority() const; 00127 00129 virtual void FlushRemoved(); 00130 00135 virtual const char* GetFileName () const; 00136 00141 virtual iVFS* GetVFS () const; 00142 00149 virtual void SetFileName (const char*, iVFS*); 00150 00167 virtual bool Load (const char* iFileName, iVFS* = 0, bool Merge = false, 00168 bool NewWins = true); 00169 00174 virtual bool Save (); 00175 00182 virtual bool Save (const char *iFileName, iVFS* = 0); 00183 00185 virtual void Clear (); 00186 00188 void CleanUp (); 00189 00196 virtual csPtr<iConfigIterator> Enumerate(const char *Subsection = 0); 00197 00199 virtual bool KeyExists(const char *Key) const; 00201 virtual bool SubsectionExists(const char *Subsection) const; 00202 00204 virtual int GetInt(const char *Key, int Def = 0) const; 00206 virtual float GetFloat(const char *Key, float Def = 0.0) const; 00208 virtual const char *GetStr(const char *Key, const char *Def = "") const; 00210 virtual bool GetBool(const char *Key, bool Def = false) const; 00212 virtual const char *GetComment(const char *Key) const; 00213 00215 virtual void SetStr (const char *Key, const char *Val); 00217 virtual void SetInt (const char *Key, int Value); 00219 virtual void SetFloat (const char *Key, float Value); 00221 virtual void SetBool (const char *Key, bool Value); 00228 virtual bool SetComment (const char *Key, const char *Text); 00230 virtual void DeleteKey(const char *Key); 00232 virtual const char *GetEOFComment() const; 00234 virtual void SetEOFComment(const char *Text); 00235 00236 private: 00237 friend class csConfigManagerIterator; 00239 bool Optimize; 00241 class csConfigDomain *DynamicDomain; 00243 class csConfigDomain *FirstDomain, *LastDomain; 00245 csRefArray<iConfigFile> Removed; 00247 csArray<iConfigIterator*> Iterators; 00248 00249 csConfigDomain *FindConfig(iConfigFile *cfg) const; 00250 csConfigDomain *FindConfig(const char *name) const; 00251 void ClearKeyAboveDynamic(const char *Key); 00252 void RemoveIterator(csConfigManagerIterator *it); 00253 void FlushRemoved(size_t n); 00254 size_t FindRemoved(const char *Filename) const; 00255 void RemoveDomain(class csConfigDomain *cfg); 00256 }; 00257 00258 #endif // __CS_CFGMGR_H__
Generated for Crystal Space by doxygen 1.4.4