Planeshift

autoexec.h

Go to the documentation of this file.
00001 /*
00002  * autoexec.h
00003  *
00004  * Author: Fabian Stock (Aiwendil)
00005  *
00006  * This program is free software; you can redistribute it and/or
00007  * modify it under the terms of the GNU General Public License
00008  * as published by the Free Software Foundation (version 2 of the License)
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  * You should have received a copy of the GNU General Public License
00014  * along with this program; if not, write to the Free Software
00015  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
00016  *
00017  */
00018 
00019 #ifndef AUTOEXEC_HEADER
00020 #define AUTOEXEC_HEADER
00021 
00022 // Crystal Space Includes
00023 #include <csutil/csstring.h>
00024 #include <csutil/array.h>
00025 
00026 struct AutoexecCommand
00027 {
00031     csString name;
00032     csString cmd; 
00033 };
00034 
00036 class Autoexec
00037 {
00038   public:
00039     Autoexec(); 
00040     ~Autoexec(); 
00041     void execute();                                 
00042 
00045     bool GetEnabled() { return enabled; };
00049     void SetEnabled(const bool en) {enabled = en;};
00050     void SaveCommands();                            
00051     void LoadDefault();                           
00052 
00057     csString getCommands(csString name);
00062     void addCommand(csString name, csString cmd);
00063   protected:
00067     void LoadCommands(const char * fileName);
00068     bool enabled;                                 
00069     csArray<AutoexecCommand> cmds;                
00070 };
00071 
00072 
00073 #endif // AUTOEXEC_HEADER
00074