| 1 |
#ifndef CMDLINEPARSER_H |
| 2 |
#define CMDLINEPARSER_H |
| 3 |
|
| 4 |
#include <string> |
| 5 |
#include <map> |
| 6 |
|
| 7 |
#include "Options.h" |
| 8 |
|
| 9 |
using std::string; |
| 10 |
using std::map; |
| 11 |
|
| 12 |
namespace FCUtils { |
| 13 |
|
| 14 |
typedef map<string,string> ArgMap; |
| 15 |
|
| 16 |
enum optmode {UPDATE,DEFINE}; |
| 17 |
|
| 18 |
class CmdLineParser { |
| 19 |
public: |
| 20 |
|
| 21 |
CmdLineParser(): optmode_(DEFINE) {}; |
| 22 |
CmdLineParser(int argc, char ** argv, optmode om=DEFINE): optmode_(om) |
| 23 |
{ ParseCmdLine(argc,argv); |
| 24 |
// MoveToOptions(); |
| 25 |
} |
| 26 |
|
| 27 |
void ParseCmdLine(int argc, char ** argv); |
| 28 |
void ParseCmdLineArg( string const &arg); |
| 29 |
void SetOptMode(optmode om){ optmode_=om; } |
| 30 |
optmode GetOptMode() const { return optmode_; } |
| 31 |
void MoveToOptions(); |
| 32 |
void Print() const; |
| 33 |
|
| 34 |
private: |
| 35 |
ArgMap args_; |
| 36 |
optmode optmode_; |
| 37 |
|
| 38 |
}; // class CmdLineParser |
| 39 |
|
| 40 |
}; // namespace FCUtils |
| 41 |
|
| 42 |
#endif //CMDLINEPARSER_H |