Page principale   Liste des namespaces   Hiérarchie des classes   Liste par ordre alphabétique   Liste des composants   Liste des fichiers   Composants   Déclarations  

Référence de la classe ExCOptions

#include <ExCOptions.h>


Membres publics

 ExCOptions ()
bool init (void)
bool load (void)
bool reload (void)
int getWindowResolutionX (void)
int getWindowResolutionY (void)
int getWindowDepth (void)
int getWindowRate (void)
bool getWindowFullscreen (void)
bool getWindowShowfps (void)
bool getDebugStyle (void)

Membres privés

bool load (int)
bool create_options_file (void)

Attributs Privés

int type_of_debug
ExCFileoptions_file
int resolution_x
int resolution_y
int rate
int depth
std::string fullscreen
std::string fps
int debug_style


Documentation des contructeurs et destructeurs

ExCOptions  
 

Définition à la ligne 26 du fichier ExCOptions.cpp.

Références debug_style, depth, EXC_NORMAL, EXNIHILO_REP_NAME, fps, fullscreen, options_file, rate, resolution_x, resolution_y, et type_of_debug.

00026                         {
00027         type_of_debug = EXC_NORMAL;
00028 #ifdef UNIX_SRC
00029         std::string where = getenv ("HOME");
00030         where += EXNIHILO_REP_NAME;
00031         where += "/options";
00032         options_file = new ExCFile (where);
00033 #endif
00034         
00035         // for the resolution
00036         resolution_x = 800;
00037         resolution_y = 600;
00038         depth = 16;
00039         rate = 75;
00040         
00041         fullscreen = "yes";
00042         fps = "yes";
00043         
00044         debug_style = EXC_NORMAL;
00045 }


Documentation des méthodes

bool create_options_file void    [private]
 

Définition à la ligne 47 du fichier ExCOptions.cpp.

Références ExCFile::add(), ExCFile::addLine(), EXNIHILO_REP_NAME, et options_file.

Référencé par init().

00047                                           {
00048 #ifdef UNIX_SRC
00049         std::string where = getenv ("HOME");
00050         where += EXNIHILO_REP_NAME;
00051 
00052         // checking for the directory
00053         struct stat stbuf;
00054         if (stat (where.data (), &stbuf) == 0) {
00055                 if (! S_ISDIR (stbuf.st_mode)) {
00056                         std::cout << where << " is not a directory, please remove it !!!" 
00057                                                         << std::endl;
00058                         return false;
00059                 } else {
00060                         std::cout << where << " created" << std::endl;
00061                 }
00062         } else {
00063                 if (mkdir (where.data (), 0755) != 0) {
00064                         std::cout << "Can not create " << where << std::endl;
00065                         return false;
00066                 } else {
00067                         std::cout << where << " created" << std::endl;
00068                 }
00069         }
00070         // ok, now, we create the options file
00071         options_file->add ("# ExNihilo Options file");
00072         options_file->add ("# you can comment a line with '#'");
00073         options_file->addLine ();
00074 
00075         // DEBUG
00076         options_file->add ("# type of debug : NORMAL, DEBUG, TRACE, LOG");
00077         options_file->add ("# you need to compile ExNihilo with debug enabled to use this option");
00078         options_file->add ("debug.type: NORMAL");
00079         options_file->addLine ();
00080 
00081         // SCREEN
00082         options_file->add ("# resolution of the screen : format WidthxHeigth:bpp@frequency");
00083         options_file->add ("# WARNING: a too big frequency may damage your screen and/or video card");
00084         options_file->add ("screen.resolution: 800x600:16@75");
00085         options_file->addLine ();
00086         options_file->add ("# start in fullscreen ? [true|false]");
00087         options_file->add ("screen.fullscreen: yes");
00088         options_file->addLine ();
00089         options_file->add ("# show fps ? [true|false]");
00090         options_file->add ("screen.fps: yes");
00091         options_file->addLine ();
00092 
00093 #endif // UNIX_SRC
00094 
00095         return true;
00096 }

bool getDebugStyle void    [inline]
 

Définition à la ligne 82 du fichier ExCOptions.h.

Références debug_style.

00082 { return debug_style; }

int getWindowDepth void    [inline]
 

Définition à la ligne 78 du fichier ExCOptions.h.

Références depth.

Référencé par ExManagerWindow::ExManagerWindow().

00078 { return depth; }

bool getWindowFullscreen void   
 

Définition à la ligne 171 du fichier ExCOptions.cpp.

Références fullscreen.

Référencé par ExManagerWindow::Apply(), et ExManagerWindow::ExManagerWindow().

00171                                           { 
00172         return (fullscreen == "yes") ? true : false; 
00173 }

int getWindowRate void    [inline]
 

Définition à la ligne 79 du fichier ExCOptions.h.

Références rate.

Référencé par ExManagerWindow::ExManagerWindow().

00079 { return rate; }

int getWindowResolutionX void    [inline]
 

Définition à la ligne 76 du fichier ExCOptions.h.

Références resolution_x.

Référencé par ExManagerWindow::ExManagerWindow(), et main().

00076 { return resolution_x; }

int getWindowResolutionY void    [inline]
 

Définition à la ligne 77 du fichier ExCOptions.h.

Références resolution_y.

Référencé par ExManagerWindow::ExManagerWindow(), et main().

00077 { return resolution_y; }

bool getWindowShowfps void   
 

Définition à la ligne 175 du fichier ExCOptions.cpp.

Références fps.

Référencé par ExManagerWindow::ExManagerWindow(), et main().

00175                                        { 
00176         return (fps == "yes") ? true : false; 
00177 }

bool init void   
 

Définition à la ligne 98 du fichier ExCOptions.cpp.

Références create_options_file(), EXC_OPTIONS_ALL, ExCFile::exist(), load(), options_file, RO, et ExCFile::setOpenMode().

Référencé par main().

00098                            {
00099 #ifdef UNIX_SRC
00100         options_file->setOpenMode (RO);
00101         if (! options_file->exist ()) {
00102                 create_options_file ();
00103         }
00104 #endif
00105         load (EXC_OPTIONS_ALL);
00106 
00107         return true;
00108 }

bool load void   
 

Définition à la ligne 163 du fichier ExCOptions.cpp.

Références EXC_OPTIONS_ALL.

Référencé par init(), et reload().

00163                            {
00164         return load (EXC_OPTIONS_ALL);
00165 }

bool load int    [private]
 

Définition à la ligne 110 du fichier ExCOptions.cpp.

Références debug_style, depth, EXC_DEBUG, EXC_LOG, EXC_NORMAL, EXC_TRACE, fps, fullscreen, ExCFile::getContent(), options_file, rate, resolution_x, resolution_y, RO, et ExCFile::setOpenMode().

00110                                {
00111 #ifdef UNIX_SRC
00112         options_file->setOpenMode (RO);
00113         // we take the content of the options file
00114         std::vector<std::string> v = options_file->getContent ();
00115         // we analyse this content
00116         std::vector<std::string>::iterator i = v.begin ();
00117         std::string analyze;
00118         while (i != v.end ()) {
00119                 analyze = *i++;
00120                 if (analyze[0] == '#') 
00121                         // if line begin by # so it's a comment
00122                         continue;
00123                 else {
00124                         if (analyze.find ('.') < analyze.size ()) {
00125                                 string type = analyze.substr (0, analyze.find ('.'));
00126                                 string under_type = analyze.substr (analyze.find ('.') + 1, analyze.size ());
00127                                 under_type = analyze.substr (analyze.find ('.') + 1, analyze.find (':') - analyze.find ('.') - 1);
00128                                 string value = analyze.substr (analyze.find (':') + 2, analyze.size ());
00129                                 
00130                                 if (type == "debug") {
00131                                         if (under_type == "type") {
00132                                                 if (value == "NORMAL") 
00133                                                         debug_style = EXC_NORMAL;
00134                                                 else if (value == "DEBUG") 
00135                                                         debug_style = EXC_DEBUG;
00136                                                 else if (value == "TRACE") 
00137                                                         debug_style = EXC_TRACE;
00138                                                 else if (value == "LOG") 
00139                                                         debug_style = EXC_LOG;
00140                                         }
00141                                 } else if (type == "screen") {
00142                                         if (under_type == "resolution") {
00143                                                 resolution_x = atoi (value.substr (0, value.find ('x')).data ());
00144                                                 value.erase (0, value.find ('x') + 1);
00145                                                 resolution_y = atoi (value.substr (0, value.find (':')).data ());
00146                                                 value.erase (0, value.find (':') + 1);
00147                                                 depth = atoi (value.substr (0, value.find ('@')).data ());
00148                                                 value.erase (0, value.find ('@') + 1);
00149                                                 rate = atoi (value.data ());
00150                                         } else if (under_type == "fullscreen") {
00151                                                 fullscreen = value;
00152                                         } else if (under_type == "fps") {
00153                                                 fps = value;
00154                                         }
00155                                 }
00156                         }
00157                 }                               
00158         }
00159 #endif  
00160         return true;
00161 }

bool reload void   
 

Définition à la ligne 167 du fichier ExCOptions.cpp.

Références EXC_OPTIONS_RELOAD, et load().

00167                              {
00168         return load (EXC_OPTIONS_RELOAD);
00169 }


Documentation des données imbriquées

int debug_style [private]
 

Définition à la ligne 67 du fichier ExCOptions.h.

Référencé par ExCOptions(), getDebugStyle(), et load().

int depth [private]
 

Définition à la ligne 63 du fichier ExCOptions.h.

Référencé par ExCOptions(), getWindowDepth(), et load().

std::string fps [private]
 

Définition à la ligne 65 du fichier ExCOptions.h.

Référencé par ExCOptions(), getWindowShowfps(), et load().

std::string fullscreen [private]
 

Définition à la ligne 64 du fichier ExCOptions.h.

Référencé par ExCOptions(), getWindowFullscreen(), et load().

ExCFile* options_file [private]
 

Définition à la ligne 55 du fichier ExCOptions.h.

Référencé par create_options_file(), ExCOptions(), init(), et load().

int rate [private]
 

Définition à la ligne 62 du fichier ExCOptions.h.

Référencé par ExCOptions(), getWindowRate(), et load().

int resolution_x [private]
 

Définition à la ligne 60 du fichier ExCOptions.h.

Référencé par ExCOptions(), getWindowResolutionX(), et load().

int resolution_y [private]
 

Définition à la ligne 61 du fichier ExCOptions.h.

Référencé par ExCOptions(), getWindowResolutionY(), et load().

int type_of_debug [private]
 

Définition à la ligne 54 du fichier ExCOptions.h.

Référencé par ExCOptions().


La documentation associée à cette classe a été générée à partir des fichiers suivants :
Généré le Tue Aug 6 20:25:38 2002 pour ExNihilo par doxygen1.2.17