Main Page   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members   File Members  

/include/ZE_ZConfigFile.h

Go to the documentation of this file.
00001 /*******************************************************************************
00002          This file is Part of the ZEngine Library for SDL Game Development.
00003                       Copyright (C) 2002 ConceptOfZero.net
00004 
00005              Licensed under the BSD License, see licensing.txt.
00006 
00007     The maintainer of this library is James Turk (jturk@conceptofzero.net) 
00008          and the home of this Library is http://www.conceptofzero.net/
00009 *******************************************************************************/
00010 
00025 #ifndef __ze_zconfigfile_h__
00026 #define __ze_zconfigfile_h__
00027 
00028 #include "ZE_ZObject.h"        //included even though ZCF isn't derived (to obtain all other needed headers)
00029 
00030 namespace ZE
00031 {
00032 
00038 class ZConfigFile : public ZObject
00039 {
00040     private:
00041 
00042         //Private Types//
00043 
00044 
00051         class ZCF_Variable
00052         {
00053             public:
00055                 string var;
00057                 string val;
00058         };
00059 
00065         class ZCF_Section
00066         {
00067             public:
00069                 string section;
00071                 list<ZCF_Variable> varList;
00072         };
00073 
00075         list<ZCF_Section> mFileLayout;
00076 
00078         string mFilename;
00079 
00087         string CleanString(string str);
00088         
00096         bool Exists(string sec);
00097 
00106         bool Exists(string sec, string var);
00107 
00116         void SetVariable(string sec, string var, string val);
00117 
00127         string GetVariable(string sec, string var, string defVal);
00128 
00129     public:
00130 
00136         ZConfigFile();
00137 
00144         ZConfigFile(string filename);
00145 
00151         ~ZConfigFile();
00152 
00159         void Process(string filename);
00160 
00170         int GetInt(string section, string var, int defVal);
00171 
00182         bool GetBool(string section, string var, bool defVal);
00183 
00193         string GetString(string section, string var, string defVal);
00194 
00204         void SetInt(string section, string var, int val);
00205 
00215         void SetBool(string section, string var, bool val);
00216 
00226         void SetString(string section, string var, string val);
00227         
00233         void Flush();
00234 
00240         void Close();
00241 };
00242 
00243 }
00244 
00245 #endif //__ze_zconfigfile_h__

Generated on Sat Dec 21 23:20:23 2002 for ZEngine by doxygen1.3-rc2