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         
00089         bool Exists(string sec);
00090         bool Exists(string sec, string var);
00091         void SetVariable(string sec, string var, string val);
00092         string GetVariable(string sec, string var, string defVal);
00093 
00094     public:
00095 
00101         ZConfigFile();
00102 
00109         ZConfigFile(string filename);
00110 
00116         ~ZConfigFile();
00117 
00124         void Process(string filename);
00125 
00135         int GetInt(string section, string var, int defVal);
00136 
00147         bool GetBool(string section, string var, bool defVal);
00148 
00158         string GetString(string section, string var, string defVal);
00159 
00169         void SetInt(string section, string var, int val);
00170 
00180         void SetBool(string section, string var, bool val);
00181 
00191         void SetString(string section, string var, string val);
00192         
00198         void Flush();
00199 
00205         void Close();
00206 };
00207 
00208 }
00209 
00210 #endif //__ze_zconfigfile_h__

Generated on Sun Dec 1 02:44:14 2002 for ZEngine by doxygen1.2.18