2 * commandoptionparser.cpp
5 * Created by Pat Schloss on 10/23/08.
6 * Copyright 2008 Patrick D. Schloss. All rights reserved.
14 #include "globaldata.hpp"
15 #include "commandoptionparser.hpp"
18 //**********************************************************************************************************************
19 //This Function parses through the command line and pulls out the command then sends the options to the parseGlobalData
20 CommandOptionParser::CommandOptionParser(string input){
22 int openParen = input.find_first_of('(');
23 int closeParen = input.find_last_of(')');
24 string optionString = "";
27 if(openParen != -1 && closeParen != -1){
28 commandString = input.substr(0, openParen); //commandString contains everything before "("
29 optionString = input.substr(openParen+1, closeParen-openParen-1); //optionString contains everything between "(" and ")".
32 GlobalData* globaldata = GlobalData::getInstance();
33 globaldata->parseGlobalData(commandString, optionString); //parser to separate and check options
36 cout << "Standard Error: " << e.what() << " has occurred in the CommandOptionParser class Function CommandOptionParser. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
40 cout << "An unknown error has occurred in the CommandOptionParser class function CommandOptionParser. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
46 //**********************************************************************************************************************
48 string CommandOptionParser::getCommandString() { return commandString; }
50 //**********************************************************************************************************************