Home | Namespaces | Hierarchy | Alphabetical List | Class list | Files | Namespace Members | Class members | File members

IIniFileReader.hpp

Go to the documentation of this file.
00001 // Copyright (c) 2007-2008 Tomer Nosrati
00002 // This file is part of the "NUSoftware Game Engine".
00003 // For conditions of distribution and use, see copyright notice in nge.hpp
00004 
00005 #pragma once
00006 #ifndef __I_INI_FILE_READER_H_INCLUDED__
00007 #define __I_INI_FILE_READER_H_INCLUDED__
00008 
00009 #include "IAudioDevice.hpp"
00010 #include "Irrlicht/irrlicht.h"
00011 
00012 using namespace nge::audio;
00013 using namespace irr;
00014 using namespace irr::io;
00015 using namespace irr::core;
00016 using namespace irr::video;
00017 
00018 namespace nge
00019 {
00020         namespace io
00021         {
00022 
00024 
00025                 class IIniFileReader : public virtual IReferenceCounted
00026                 {
00027                 public:
00028                         // forward declarations to make the code more readable
00029                         class SValue2Df;
00030                         class SValue2Di;
00031                         class SValue3Df;
00032                         class SValue3Di;
00033                         class SValue4Df;
00034                         class SValue4Di;
00035                         struct SSection;
00036                         struct SKey;
00037 
00039                         virtual ~IIniFileReader() {}
00040 
00042                         virtual bool load() = 0;
00044                         virtual bool save() = 0;
00045 
00047                         virtual void setSaveOnDestroy(bool enabled) = 0;
00048 
00050                         virtual void setSaveFileName(stringc fileName) = 0;
00051 
00053                         virtual c8* getValue(const c8* section, const c8* key) = 0;
00054 
00056                         virtual const wchar_t* getValueW(const c8* section, const c8* key) = 0;
00057 
00059                         virtual int getValueI(const c8* section, const c8* key) = 0;
00060 
00062                         virtual float getValueF(const c8* section, const c8* key) = 0;
00063 
00065                         virtual bool getValueB(const c8* section, const c8* key) = 0;
00066 
00068                         virtual SValue2Di getValue2Di(const c8* section, const c8* key) = 0;
00069 
00071                         virtual SValue2Df getValue2Df(const c8* section, const c8* key) = 0;
00072 
00074                         virtual SValue3Di getValue3Di(const c8* section, const c8 *key) = 0;
00075 
00077                         virtual SValue3Df getValue3Df(const c8* section, const c8* key) = 0;
00078 
00080                         virtual SValue4Di getValue4Di(const c8* section, const c8* key) = 0;
00081 
00083                         virtual SValue4Df getValue4Df(const c8* section, const c8* key) = 0;
00084 
00086                         virtual EKEY_CODE getValueK(const c8* section, const c8* key) = 0;
00087 
00091                         virtual E_DRIVER_TYPE getValueDrv(const c8* section, const c8* key) = 0;
00092 
00093                         virtual E_AUDIO_DEVICE getValueAudioDev(const c8* section, const c8* key) = 0;
00094 
00096                         virtual u32 getValueU32(const c8* section, const c8* key) = 0;
00097 
00099                         virtual void setValue(const c8* section, const c8* key, const c8* value) = 0;
00100 
00102                         virtual void setValue(const c8* section, const c8* key, const wchar_t* value) = 0;
00103 
00105                         virtual void setValue(const c8* section, const c8* key, int value) = 0;
00106 
00108                         virtual void setValue(const c8* section, const c8* key, float value) = 0;
00109 
00111                         virtual void setValue(const c8* section, const c8* key, bool value) = 0;
00112 
00114                         virtual void setValue(const c8* section, const c8* key, SValue2Di value) = 0;
00115 
00117                         virtual void setValue(const c8* section, const c8* key, SValue2Df value) = 0;
00118 
00120                         virtual void setValue(const c8* section, const c8* key, SValue3Di value) = 0;
00121 
00123                         virtual void setValue(const c8* section, const c8* key, SValue3Df value) = 0;
00124 
00126                         virtual void setValue(const c8* section, const c8* key, SValue4Di value) = 0;
00127 
00129                         virtual void setValue(const c8* section, const c8* key, SValue4Df value) = 0;
00130 
00132                         virtual void setValue(const c8* section, const c8* key, EKEY_CODE value) = 0;
00133 
00135                         virtual void setValue(const c8* section, const c8* key, E_DRIVER_TYPE value) = 0;
00136 
00137                         virtual void setValue(const c8* section, const c8* key, E_AUDIO_DEVICE value) = 0;
00138 
00140                         virtual void setValue(const c8* section, const c8* key, u32 value) = 0;
00141 
00143                         virtual array<SSection*> getAllSections() = 0;
00144 
00146                         virtual SSection* getSection(const c8* name) = 0;
00147 
00149                         virtual void removeAll() = 0;
00150 
00152                         virtual void addSection(const c8* name) = 0;
00153 
00157                         virtual void addKeyToSection(const c8* section, const c8* name, const c8* value=0) = 0;
00158 
00160                         struct SKey
00161                         {
00163                                 c8 Name[64];
00165                                 c8 Value[64];
00166                         };
00167 
00169                         struct SSection
00170                         {
00172                                 c8 Name[64];
00174                                 array<SKey*> Keys;
00175                         };
00176 
00178                         class SValue2Di
00179                         {
00180                         public:
00181                                 SValue2Di();
00182                                 SValue2Di(dimension2di);
00183                                 SValue2Di(position2di);
00184                                 SValue2Di(vector2di);
00185 
00187                                 s32 X;
00189                                 s32 Y;
00190 
00192                                 dimension2di toDimension();
00194                                 position2di toPosition();
00196                                 vector2di toVector();
00197                         };
00198 
00200                         class SValue2Df
00201                         {
00202                         public:
00203                                 SValue2Df();
00204                                 SValue2Df(dimension2df);
00205                                 SValue2Df(position2df);
00206                                 SValue2Df(vector2df);
00207 
00209                                 f32 X;
00211                                 f32 Y;
00212 
00214                                 dimension2df toDimension();
00216                                 position2df toPosition();
00218                                 vector2df toVector();
00219                         };
00220 
00222                         class SValue3Di
00223                         {
00224                         public:
00225                                 SValue3Di();
00226                                 SValue3Di(SColor);
00227                                 SValue3Di(vector3di);
00228 
00230                                 s32 X;
00232                                 s32 Y;
00234                                 s32 Z;
00235 
00237                                 SColor toSColor();
00239                                 vector3di toVector();
00240                         };
00241 
00243                         class SValue3Df
00244                         {
00245                         public:
00246                                 SValue3Df();
00247                                 SValue3Df(SColorf);
00248                                 SValue3Df(vector3df);
00249 
00251                                 f32 X;
00253                                 f32 Y;
00255                                 f32 Z;
00256 
00258                                 SColorf toSColorf();
00260                                 vector3df toVector();
00261                         };
00262 
00264                         class SValue4Di
00265                         {
00266                         public:
00267                                 SValue4Di();
00268                                 SValue4Di(SColor);
00269                                 SValue4Di(rect<s32>);
00270 
00272                                 s32 X1;
00274                                 s32 Y1;
00276                                 s32 X2;
00278                                 s32 Y2;
00279 
00281                                 SColor toSColor();
00283                                 rect<s32> toRect();
00284                         };
00285 
00287                         class SValue4Df
00288                         {
00289                         public:
00290                                 SValue4Df();
00291                                 SValue4Df(SColorf);
00292                                 SValue4Df(rect<f32>);
00293 
00295                                 f32 X1;
00297                                 f32 Y1;
00299                                 f32 X2;
00301                                 f32 Y2;
00302 
00304                                 SColorf toSColorf();
00306                                 rect<f32> toRect();
00307                         };
00308                 };
00309 
00311                 IIniFileReader* createIniFileReader(const c8* file, bool saveOnDestroy = false);
00312 
00314                 IIniFileReader* createIniFileReader(IReadFile* file, bool saveOnDestroy = false);
00315 
00317                 IIniFileReader* createIniFileReaderEmpty();
00318 
00319         } // namespace io
00320 } // namespace nge
00321 
00322 #endif // __I_INI_FILE_READER_H_INCLUDED__

The NUSoftware Game Engine
The NUSoftware Game Engine Documentation © 2007-2008 by Tomer Nosrati. Generated on Sat Apr 26 16:52:34 2008 by Doxygen (1.5.5)