1
0
Fork 0

Move commandline to programs.h

Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@3082
This commit is contained in:
Peter Veenstra 2008-01-19 11:02:29 +00:00
parent 41a5d9d3d6
commit 61db3e5178
4 changed files with 49 additions and 28 deletions

View file

@ -16,6 +16,8 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
/* $Id: programs.h,v 1.15 2008-01-19 11:02:29 qbix79 Exp $ */
#ifndef DOSBOX_PROGRAMS_H
#define DOSBOX_PROGRAMS_H
@ -25,10 +27,39 @@
#ifndef DOSBOX_DOS_INC_H
#include "dos_inc.h"
#endif
#ifndef DOSBOX_SETUP_H
#include "setup.h"
#ifndef CH_LIST
#define CH_LIST
#include <list>
#endif
#ifndef CH_STRING
#define CH_STRING
#include <string>
#endif
class CommandLine {
public:
CommandLine(int argc,char const * const argv[]);
CommandLine(char const * const name,char const * const cmdline);
const char * GetFileName(){ return file_name.c_str();}
bool FindExist(char const * const name,bool remove=false);
bool FindHex(char const * const name,int & value,bool remove=false);
bool FindInt(char const * const name,int & value,bool remove=false);
bool FindString(char const * const name,std::string & value,bool remove=false);
bool FindCommand(unsigned int which,std::string & value);
bool FindStringBegin(char const * const begin,std::string & value, bool remove=false);
bool FindStringRemain(char const * const name,std::string & value);
bool GetStringRemain(std::string & value);
unsigned int GetCount(void);
void Shift(unsigned int amount=1);
private:
typedef std::list<std::string>::iterator cmd_it;
std::list<std::string> cmds;
std::string file_name;
bool FindEntry(char const * const name,cmd_it & it,bool neednext=false);
};
class Program {
public:

View file

@ -16,7 +16,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
/* $Id: setup.h,v 1.28 2007-10-21 08:43:24 qbix79 Exp $ */
/* $Id: setup.h,v 1.29 2008-01-19 11:02:29 qbix79 Exp $ */
#ifndef DOSBOX_SETUP_H
#define DOSBOX_SETUP_H
@ -28,31 +28,19 @@
#ifndef DOSBOX_CROSS_H
#include "cross.h"
#endif
#include <string>
#ifndef DOSBOX_PROGRAMS_H
#include "programs.h"
#endif
#ifndef CH_LIST
#define CH_LIST
#include <list>
#endif
class CommandLine {
public:
CommandLine(int argc,char const * const argv[]);
CommandLine(char const * const name,char const * const cmdline);
const char * GetFileName(){ return file_name.c_str();}
bool FindExist(char const * const name,bool remove=false);
bool FindHex(char const * const name,int & value,bool remove=false);
bool FindInt(char const * const name,int & value,bool remove=false);
bool FindString(char const * const name,std::string & value,bool remove=false);
bool FindCommand(unsigned int which,std::string & value);
bool FindStringBegin(char const * const begin,std::string & value, bool remove=false);
bool FindStringRemain(char const * const name,std::string & value);
bool GetStringRemain(std::string & value);
unsigned int GetCount(void);
void Shift(unsigned int amount=1);
private:
typedef std::list<std::string>::iterator cmd_it;
std::list<std::string> cmds;
std::string file_name;
bool FindEntry(char const * const name,cmd_it & it,bool neednext=false);
};
#ifndef CH_STRING
#define CH_STRING
#include <string>
#endif
union Value{
int _hex;

View file

@ -16,7 +16,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
/* $Id: dos_programs.cpp,v 1.81 2007-12-27 15:38:00 qbix79 Exp $ */
/* $Id: dos_programs.cpp,v 1.82 2008-01-19 11:02:29 qbix79 Exp $ */
#include "dosbox.h"
#include <stdlib.h>
@ -34,6 +34,7 @@
#include "dos_system.h"
#include "dos_inc.h"
#include "bios.h"
#include "setup.h"
#if defined HAVE_SYS_TYPES_H && defined HAVE_PWD_H
#include <sys/types.h>

View file

@ -16,7 +16,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
/* $Id: shell_cmds.cpp,v 1.79 2007-10-16 07:29:22 qbix79 Exp $ */
/* $Id: shell_cmds.cpp,v 1.80 2008-01-19 11:02:29 qbix79 Exp $ */
#include "dosbox.h"
#include "shell.h"
@ -24,6 +24,7 @@
#include "regs.h"
#include "../dos/drives.h"
#include "support.h"
#include "setup.h"
#include <cstring>
#include <cctype>
#include <cstdlib>