Changes in src/CommandLineParser.cpp [112b09:7e6b00]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/CommandLineParser.cpp
r112b09 r7e6b00 6 6 */ 7 7 8 #include "Helpers/MemDebug.hpp"9 10 8 #include <boost/program_options.hpp> 11 9 #include <fstream> 12 10 #include <iostream> 11 #include <map> 13 12 14 13 #include "Patterns/Singleton_impl.hpp" 15 14 #include "CommandLineParser.hpp" 15 #include "log.hpp" 16 #include "verbose.hpp" 16 17 17 18 using namespace std; … … 47 48 } 48 49 50 /** Scan the argument list for -a or --arguments and store their order for later use. 51 * \param &ShortFormToActionMap e.g. gives "help" for "h" 52 */ 53 void CommandLineParser::scanforSequenceOfArguments(map <std::string, std::string> &ShortFormToActionMap) 54 { 55 // go through all arguments 56 for (int i=1;i<argc;i++) { 57 (cout << Verbose(1) << "Checking on " << argv[i] << endl); 58 // check whether they begin with - or -- and check that next letter is not numeric, if so insert 59 if (argv[i][0] == '-') { 60 (cout << Verbose(1) << "Possible argument: " << argv[i] << endl); 61 if (argv[i][1] == '-') { 62 (cout << Verbose(1) << "Putting " << argv[i] << " into the sequence." << endl); 63 SequenceOfActions.push_back(&(argv[i][2])); 64 } else if (((argv[i][1] < '0') || (argv[i][1] > '9')) && ((argv[i][1] != '.'))) { 65 map <std::string, std::string>::iterator iter = ShortFormToActionMap.find(&(argv[i][1])); 66 if (iter != ShortFormToActionMap.end()) { 67 (cout << Verbose(1) << "Putting " << iter->second << " for " << iter->first << " into the sequence." << endl); 68 SequenceOfActions.push_back(iter->second); 69 } 70 } 71 } 72 } 73 } 49 74 50 75 … … 74 99 * \param **_argv argument array from main() 75 100 */ 76 void CommandLineParser::Run(int _argc, char **_argv )101 void CommandLineParser::Run(int _argc, char **_argv, map <std::string, std::string> &ShortFormToActionMap) 77 102 { 78 103 setOptions(_argc,_argv); 79 104 Parse(); 105 scanforSequenceOfArguments(ShortFormToActionMap); 80 106 } 81 107
Note:
See TracChangeset
for help on using the changeset viewer.