Debian Codegraph @

include/programs.h

raw symbols SCIP
1 /*
2 * Copyright (C) 2002-2010 The DOSBox Team
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17 */
18
19 /* $Id: programs.h,v 1.19 2009-05-27 09:15:41 qbix79 Exp $ */
20
21 #ifndef DOSBOX_PROGRAMS_H
22 #define DOSBOX_PROGRAMS_H
23
24 #ifndef DOSBOX_DOSBOX_H
25 #include "dosbox.h"
26 #endif
27 #ifndef DOSBOX_DOS_INC_H
28 #include "dos_inc.h"
29 #endif
30
31 #ifndef CH_LIST
32 #define CH_LIST
33 #include <list>
34 #endif
35
36 #ifndef CH_STRING
37 #define CH_STRING
38 #include <string>
39 #endif
40
41 class CommandLine {
42 public:
43 CommandLine(int argc,char const * const argv[]);
44 CommandLine(char const * const name,char const * const cmdline);
45 const char * GetFileName(){ return file_name.c_str();}
46
47 bool FindExist(char const * const name,bool remove=false);
48 bool FindHex(char const * const name,int & value,bool remove=false);
49 bool FindInt(char const * const name,int & value,bool remove=false);
50 bool FindString(char const * const name,std::string & value,bool remove=false);
51 bool FindCommand(unsigned int which,std::string & value);
52 bool FindStringBegin(char const * const begin,std::string & value, bool remove=false);
53 bool FindStringRemain(char const * const name,std::string & value);
54 bool GetStringRemain(std::string & value);
55 unsigned int GetCount(void);
56 void Shift(unsigned int amount=1);
57 Bit16u Get_arglength();
58
59 private:
60 typedef std::list<std::string>::iterator cmd_it;
61 std::list<std::string> cmds;
62 std::string file_name;
63 bool FindEntry(char const * const name,cmd_it & it,bool neednext=false);
64 };
65
66 class Program {
67 public:
68 Program();
69 virtual ~Program(){
70 delete cmd;
71 delete psp;
72 }
73 std::string temp_line;
74 CommandLine * cmd;
75 DOS_PSP * psp;
76 virtual void Run(void)=0;
77 bool GetEnvStr(const char * entry,std::string & result);
78 bool GetEnvNum(Bitu num,std::string & result);
79 Bitu GetEnvCount(void);
80 bool SetEnv(const char * entry,const char * new_string);
81 void WriteOut(const char * format,...); /* Write to standard output */
82 void WriteOut_NoParsing(const char * format); /* Write to standard output, no parsing */
83 void ChangeToLongCmd();
84
85 };
86
87 typedef void (PROGRAMS_Main)(Program * * make);
88 void PROGRAMS_MakeFile(char const * const name,PROGRAMS_Main * main);
89
90 #endif