DOSBox-X
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines
include/control.h
00001 /*
00002  *  Copyright (C) 2002-2013  The DOSBox Team
00003  *
00004  *  This program is free software; you can redistribute it and/or modify
00005  *  it under the terms of the GNU General Public License as published by
00006  *  the Free Software Foundation; either version 2 of the License, or
00007  *  (at your option) any later version.
00008  *
00009  *  This program is distributed in the hope that it will be useful,
00010  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012  *  GNU General Public License for more details.
00013  *
00014  *  You should have received a copy of the GNU General Public License
00015  *  along with this program; if not, write to the Free Software
00016  *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
00017  */
00018 
00019 
00020 #ifndef DOSBOX_CONTROL_H
00021 #define DOSBOX_CONTROL_H
00022 
00023 #ifdef _MSC_VER
00024 //#pragma warning ( disable : 4786 )
00025 //#pragma warning ( disable : 4290 )
00026 #endif
00027 
00028 #ifndef DOSBOX_PROGRAMS_H
00029 #include "programs.h"
00030 #endif
00031 #ifndef DOSBOX_SETUP_H
00032 #include "setup.h"
00033 #endif
00034 
00035 #ifndef CH_LIST
00036 #define CH_LIST
00037 #include <list>
00038 #endif
00039 
00040 #ifndef CH_VECTOR
00041 #define CH_VECTOR
00042 #include <vector>
00043 #endif
00044 
00045 #ifndef CH_STRING
00046 #define CH_STRING
00047 #include <string>
00048 #endif
00049 
00050 
00051 
00052 
00053 class Config{
00054 public:
00055         CommandLine * cmdline;
00056 private:
00057         std::list<Section*> sectionlist;
00058         typedef std::list<Section*>::iterator it;
00059         typedef std::list<Section*>::reverse_iterator reverse_it;
00060         typedef std::list<Section*>::const_iterator const_it;
00061         typedef std::list<Section*>::const_reverse_iterator const_reverse_it;
00062 //      void (* _start_function)(void);
00063         bool secure_mode; //Sandbox mode
00064 public:
00065         bool initialised;
00066     std::vector<std::string> auto_bat_additional;
00067         std::vector<std::string> startup_params;
00068         std::vector<std::string> configfiles;
00069         Config(CommandLine * cmd):cmdline(cmd),secure_mode(false) {
00070                 startup_params.push_back(cmdline->GetFileName());
00071                 cmdline->FillVector(startup_params);
00072                 opt_exit = false;
00073                 opt_debug = false;
00074                 opt_nogui = false;
00075                 opt_nomenu = false;
00076         opt_showrt = false;
00077                 opt_startui = false;
00078                 initialised = false;
00079                 opt_console = false;
00080                 opt_userconf = false;
00081                 opt_noconsole = false;
00082                 opt_eraseconf = false;
00083                 opt_resetconf = false;
00084                 opt_printconf = false;
00085                 opt_noautoexec = false;
00086                 opt_securemode = false;
00087                 opt_fullscreen = false;
00088                 opt_showcycles = false;
00089                 opt_earlydebug = false;
00090                 opt_break_start = false;
00091                 opt_erasemapper = false;
00092                 opt_resetmapper = false;
00093                 opt_startmapper = false;
00094         opt_fastbioslogo = false;
00095                 opt_date_host_forced = false;
00096                 opt_disable_numlock_check = false;
00097                 opt_disable_dpi_awareness = false;
00098         opt_time_limit = -1;
00099         opt_log_con = false;
00100     }
00101         ~Config();
00102 
00103         Section_line * AddSection_line(char const * const _name,void (*_initfunction)(Section*));
00104         Section_prop * AddSection_prop(char const * const _name,void (*_initfunction)(Section*),bool canchange=false);
00105         
00106         Section* GetSection(int index);
00107         Section* GetSection(std::string const&_sectionname) const;
00108         Section* GetSectionFromProperty(char const * const prop) const;
00109 
00110         bool PrintConfig(char const * const configfilename,bool everything=false) const;
00111         bool ParseConfigFile(char const * const configfilename);
00112         void ParseEnv(char ** envp);
00113         bool SecureMode() const { return secure_mode; }
00114         void SwitchToSecureMode() { secure_mode = true; }//can't be undone
00115 public:
00116     bool opt_log_con;
00117     double opt_time_limit;
00118         std::string opt_editconf,opt_opensaves,opt_opencaptures,opt_lang;
00119         std::vector<std::string> config_file_list;
00120         std::vector<std::string> opt_c;
00121         bool opt_disable_dpi_awareness;
00122         bool opt_disable_numlock_check;
00123         bool opt_date_host_forced;
00124     bool opt_fastbioslogo;
00125         bool opt_break_start;
00126         bool opt_erasemapper;
00127         bool opt_resetmapper;
00128         bool opt_startmapper;
00129         bool opt_noautoexec;
00130         bool opt_securemode;
00131         bool opt_fullscreen;
00132         bool opt_showcycles;
00133         bool opt_earlydebug;
00134         bool opt_noconsole;
00135         bool opt_eraseconf;
00136         bool opt_resetconf;
00137         bool opt_printconf;
00138         bool opt_userconf;
00139         bool opt_console;
00140         bool opt_startui;
00141     bool opt_showrt;
00142         bool opt_nomenu;
00143         bool opt_debug;
00144         bool opt_nogui;
00145         bool opt_exit;
00146 };
00147 
00148 #endif