2 * commandoptionparser.cpp
5 * Created by Pat Schloss on 10/23/08.
6 * Copyright 2008 Patrick D. Schloss. All rights reserved.
11 #include "globaldata.hpp"
12 #include "commandoptionparser.hpp"
15 //**********************************************************************************************************************
16 //This Function parses through the command line and pulls out the command then sends the options to the parseGlobalData
17 CommandOptionParser::CommandOptionParser(string input){
19 m = MothurOut::getInstance();
21 int openParen = input.find_first_of('(');
22 int closeParen = input.find_last_of(')');
26 if(openParen != -1 && closeParen != -1){
27 commandString = input.substr(0, openParen); //commandString contains everything before "("
28 optionString = input.substr((openParen+1), (closeParen-openParen-1)); //optionString contains everything between "(" and ")".
30 else if (openParen == -1) { m->mothurOut("You are missing ("); m->mothurOutEndLine(); }
31 else if (closeParen == -1) { m->mothurOut("You are missing )"); m->mothurOutEndLine(); }
33 //GlobalData* globaldata = GlobalData::getInstance();
34 //globaldata->parseGlobalData(commandString, optionString); //parser to separate and check options
37 m->errorOut(e, "CommandOptionParser", "CommandOptionParser");
42 //**********************************************************************************************************************
44 string CommandOptionParser::getCommandString() { return commandString; }
46 //**********************************************************************************************************************
48 string CommandOptionParser::getOptionString() { return optionString; }
50 //**********************************************************************************************************************