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

/home/James/ZEngine-dev/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                 class ZCF_Variable
00044                 {
00045                         public:
00046                                 string var;
00047                                 string val;
00048                 };
00049                 class ZCF_Section
00050                 {
00051                         public:
00052                                 string section;
00053                                 list<ZCF_Variable> varList;
00054                 };
00055 
00057                 list<ZCF_Section> mFileLayout;
00058 
00060                 string mFilename;
00061 
00069                 string CleanString(string str);
00070                 
00071                 bool Exists(string sec);
00072                 bool Exists(string sec, string var);
00073                 void SetVariable(string sec, string var, string val);
00074                 string GetVariable(string sec, string var, string defVal);
00075 
00076         public:
00077 
00083                 ZConfigFile();
00084 
00091                 ZConfigFile(string filename);
00092 
00098                 ~ZConfigFile();
00099 
00106                 void Process(string filename);
00107 
00117                 int GetInt(string section, string var, int defVal);
00118 
00129                 bool GetBool(string section, string var, bool defVal);
00130 
00140                 string GetString(string section, string var, string defVal);
00141 
00151                 void SetInt(string section, string var, int val);
00152 
00162                 void SetBool(string section, string var, bool val);
00163 
00173                 void SetString(string section, string var, string val);
00174                 
00180                 void Flush();
00181 
00187                 void Close();
00188 };
00189 
00190 }
00191 
00192 #endif //__ze_zconfigfile_h__

Generated on Wed Nov 20 01:18:05 2002 for ZEngine by doxygen1.3-rc1