1
0
Fork 0

Addes some new functions to commandline class.

Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@310
This commit is contained in:
Sjoerd van der Berg 2002-09-29 13:59:46 +00:00
parent a883462e22
commit 765726f755

View file

@ -233,9 +233,12 @@ bool CommandLine::FindString(char * name,std::string & value,bool remove) {
return true;
}
bool CommandLine::FindFirst(std::string & value) {
if (cmds.empty()) return false;
value=*cmds.begin();
bool CommandLine::FindCommand(int which,std::string & value) {
if (which<1) return false;
if (which>cmds.size()) return false;
cmd_it it=cmds.begin();
for (;which>1;which--) it++;
value=(*it);
return true;
}
@ -250,6 +253,24 @@ bool CommandLine::FindEntry(char * name,cmd_it & it,bool neednext) {
return false;
}
bool CommandLine::FindStringBegin(char * begin,std::string & value, bool remove) {
cmd_it it;
for (it=cmds.begin();it!=cmds.end();it++) {
if (strncmp(begin,(*it).c_str(),strlen(begin))==0) {
value=((*it).c_str()+strlen(begin));
return true;
}
}
return false;
}
int CommandLine::GetCount(void) {
return cmds.size();
}
CommandLine::CommandLine(int argc,char * argv[]) {
if (argc>0) {
file_name=argv[0];