|
OpenADFortTk (basic)
|
#include <CmdLineParser.h>

Classes | |
| class | Exception |
| class | InternalError |
| struct | OptArgDesc |
| class | ParseError |
| class | SwDesc |
Public Types | |
| enum | OptKind { ARG_NULL = 0, ARG_NONE, ARG_REQ, ARG_OPT } |
| enum | DupOptKind { DUPOPT_NULL = 0, DUPOPT_ERR, DUPOPT_CLOB, DUPOPT_CAT } |
Public Member Functions | |
| CmdLineParser () | |
| CmdLineParser (const OptArgDesc *optArgDescs, int argc, const char *const argv[]) | |
| ~CmdLineParser () | |
| void | Parse (const OptArgDesc *optArgDescs, int argc, const char *const argv[]) |
| const std::string & | GetCmd () const |
| bool | IsOpt (const char swShort) const |
| bool | IsOpt (const char *swLong) const |
| bool | IsOpt (const std::string &sw) const |
| bool | IsOptArg (const char swShort) const |
| bool | IsOptArg (const char *swLong) const |
| bool | IsOptArg (const std::string &sw) const |
| const std::string & | GetOptArg (const char swShort) const |
| const std::string & | GetOptArg (const char *swLong) const |
| const std::string & | GetOptArg (const std::string &sw) const |
| unsigned int | GetNumArgs () const |
| const std::string & | GetArg (unsigned int i) const |
| void | Dump (std::ostream &os=std::cerr) const |
| void | DDump () const |
Static Public Member Functions | |
| static long | ToLong (const std::string &str) |
| static uint64_t | ToUInt64 (const std::string &str) |
| static double | ToDbl (const std::string &str) |
Static Public Attributes | |
| static OptArgDesc | OptArgDesc_NULL |
Private Types | |
| typedef std::map< std::string, std::string * > | SwitchToArgMap |
| typedef std::vector< std::string > | ArgVec |
Private Member Functions | |
| CmdLineParser (const CmdLineParser &p) | |
| CmdLineParser & | operator= (const CmdLineParser &x) |
| void | Ctor () |
| void | Reset () |
| void | CheckForErrors (const OptArgDesc *optArgDescs) |
| const OptArgDesc * | CreateSortedCopy (const OptArgDesc *optArgDescs) |
| SwDesc | MakeSwitchDesc (const char *str) |
| const OptArgDesc * | FindOptDesc (const OptArgDesc *optArgDescs, const SwDesc &swdesc, bool errOnMultipleMatches=true) |
| void | AddOption (const OptArgDesc &odesc, const SwDesc &swdesc) |
| void | AddOption (const OptArgDesc &odesc, const std::string &sw, const std::string &arg) |
Private Attributes | |
| std::string | command |
| SwitchToArgMap | switchToArgMap |
| ArgVec | arguments |
Definition at line 88 of file CmdLineParser.h.
typedef std::vector<std::string> CmdLineParser::ArgVec [private] |
Definition at line 252 of file CmdLineParser.h.
typedef std::map<std::string, std::string*> CmdLineParser::SwitchToArgMap [private] |
Definition at line 251 of file CmdLineParser.h.
Definition at line 104 of file CmdLineParser.h.
Definition at line 96 of file CmdLineParser.h.
Definition at line 89 of file CmdLineParser.cxx.
References Ctor().

| CmdLineParser::CmdLineParser | ( | const OptArgDesc * | optArgDescs, |
| int | argc, | ||
| const char *const | argv[] | ||
| ) |
Definition at line 94 of file CmdLineParser.cxx.
References Ctor(), and Parse().

Definition at line 109 of file CmdLineParser.cxx.
References Reset().

| CmdLineParser::CmdLineParser | ( | const CmdLineParser & | p | ) | [inline, private] |
Definition at line 248 of file CmdLineParser.h.
| void CmdLineParser::AddOption | ( | const OptArgDesc & | odesc, |
| const SwDesc & | swdesc | ||
| ) | [private] |
Definition at line 589 of file CmdLineParser.cxx.
References CmdLineParser::SwDesc::arg, CmdLineParser::OptArgDesc::swLong, and CmdLineParser::OptArgDesc::swShort.
Referenced by Parse().
| void CmdLineParser::AddOption | ( | const OptArgDesc & | odesc, |
| const std::string & | sw, | ||
| const std::string & | arg | ||
| ) | [private] |
Definition at line 608 of file CmdLineParser.cxx.
References CmdLineParser::OptArgDesc::dupArgSep, CmdLineParser::OptArgDesc::dupKind, DUPOPT_CAT, DUPOPT_CLOB, DUPOPT_ERR, and switchToArgMap.
| void CmdLineParser::CheckForErrors | ( | const OptArgDesc * | optArgDescs | ) | [private] |
Definition at line 438 of file CmdLineParser.cxx.
References ARG_NULL, DUPOPT_CAT, DUPOPT_NULL, and OptArgDesc_NULL.
Referenced by Parse().
| const CmdLineParser::OptArgDesc * CmdLineParser::CreateSortedCopy | ( | const OptArgDesc * | optArgDescs | ) | [private] |
Definition at line 413 of file CmdLineParser.cxx.
References OptArgDesc_NULL.
Referenced by Parse().
| void CmdLineParser::Ctor | ( | ) | [private] |
Definition at line 102 of file CmdLineParser.cxx.
Referenced by CmdLineParser().
| void CmdLineParser::DDump | ( | ) | const |
Definition at line 388 of file CmdLineParser.cxx.
References Dump().

| void CmdLineParser::Dump | ( | std::ostream & | os = std::cerr | ) | const |
Definition at line 368 of file CmdLineParser.cxx.
References arguments, GetCmd(), and switchToArgMap.
Referenced by DDump(), and Args::Dump().

| const CmdLineParser::OptArgDesc * CmdLineParser::FindOptDesc | ( | const OptArgDesc * | optArgDescs, |
| const SwDesc & | swdesc, | ||
| bool | errOnMultipleMatches = true |
||
| ) | [private] |
Definition at line 530 of file CmdLineParser.cxx.
References CmdLineParser::SwDesc::isLong, OptArgDesc_NULL, CmdLineParser::SwDesc::sw, CmdLineParser::OptArgDesc::swLong, and CmdLineParser::OptArgDesc::swShort.
Referenced by Parse().
| const string & CmdLineParser::GetArg | ( | unsigned int | i | ) | const |
Definition at line 292 of file CmdLineParser.cxx.
References arguments.
Referenced by Args::Parse().
| const string & CmdLineParser::GetCmd | ( | ) | const |
Definition at line 200 of file CmdLineParser.cxx.
References command.
Referenced by Dump(), and Args::GetCmd().
| unsigned int CmdLineParser::GetNumArgs | ( | ) | const |
Definition at line 286 of file CmdLineParser.cxx.
References arguments.
Referenced by Args::Parse().
| const string & CmdLineParser::GetOptArg | ( | const char | swShort | ) | const |
Definition at line 257 of file CmdLineParser.cxx.
Referenced by GetOptArg(), and Args::Parse().
| const string & CmdLineParser::GetOptArg | ( | const char * | swLong | ) | const |
Definition at line 264 of file CmdLineParser.cxx.
References GetOptArg().

| const string & CmdLineParser::GetOptArg | ( | const std::string & | sw | ) | const |
Definition at line 271 of file CmdLineParser.cxx.
References switchToArgMap.
| bool CmdLineParser::IsOpt | ( | const char | swShort | ) | const |
Definition at line 208 of file CmdLineParser.cxx.
Referenced by IsOpt(), and Args::Parse().
| bool CmdLineParser::IsOpt | ( | const char * | swLong | ) | const |
Definition at line 215 of file CmdLineParser.cxx.
References IsOpt().

| bool CmdLineParser::IsOpt | ( | const std::string & | sw | ) | const |
Definition at line 222 of file CmdLineParser.cxx.
References switchToArgMap.
| bool CmdLineParser::IsOptArg | ( | const char | swShort | ) | const |
Definition at line 231 of file CmdLineParser.cxx.
Referenced by IsOptArg(), and Args::Parse().
| bool CmdLineParser::IsOptArg | ( | const char * | swLong | ) | const |
Definition at line 238 of file CmdLineParser.cxx.
References IsOptArg().

| bool CmdLineParser::IsOptArg | ( | const std::string & | sw | ) | const |
Definition at line 245 of file CmdLineParser.cxx.
References switchToArgMap.
| CmdLineParser::SwDesc CmdLineParser::MakeSwitchDesc | ( | const char * | str | ) | [private] |
Definition at line 484 of file CmdLineParser.cxx.
References CmdLineParser::SwDesc::arg, CmdLineParser::SwDesc::isLong, IsLongSwitch(), IsShortSwitch(), and CmdLineParser::SwDesc::sw.
Referenced by Parse().

| CmdLineParser& CmdLineParser::operator= | ( | const CmdLineParser & | x | ) | [inline, private] |
Definition at line 249 of file CmdLineParser.h.
| void CmdLineParser::Parse | ( | const OptArgDesc * | optArgDescs, |
| int | argc, | ||
| const char *const | argv[] | ||
| ) |
Definition at line 116 of file CmdLineParser.cxx.
References AddOption(), CmdLineParser::SwDesc::arg, ARG_NONE, ARG_OPT, ARG_REQ, arguments, CheckForErrors(), command, CreateSortedCopy(), FindOptDesc(), IsArg(), IsDashDash(), IsSwitch(), CmdLineParser::OptArgDesc::kind, MakeSwitchDesc(), MISSING_ARG, MISSING_SWITCH, Reset(), CmdLineParser::SwDesc::sw, and UNKNOWN_SWITCH.
Referenced by CmdLineParser(), and Args::Parse().

| void CmdLineParser::Reset | ( | ) | [private] |
Definition at line 398 of file CmdLineParser.cxx.
References arguments, and switchToArgMap.
Referenced by Parse(), and ~CmdLineParser().
| double CmdLineParser::ToDbl | ( | const std::string & | str | ) | [static] |
Definition at line 345 of file CmdLineParser.cxx.
| long CmdLineParser::ToLong | ( | const std::string & | str | ) | [static] |
Definition at line 301 of file CmdLineParser.cxx.
Referenced by Args::Parse().
| uint64_t CmdLineParser::ToUInt64 | ( | const std::string & | str | ) | [static] |
Definition at line 323 of file CmdLineParser.cxx.
ArgVec CmdLineParser::arguments [private] |
Definition at line 298 of file CmdLineParser.h.
Referenced by Dump(), GetArg(), GetNumArgs(), Parse(), and Reset().
std::string CmdLineParser::command [private] |
Definition at line 296 of file CmdLineParser.h.
Definition at line 130 of file CmdLineParser.h.
Referenced by CheckForErrors(), CreateSortedCopy(), and FindOptDesc().
SwitchToArgMap CmdLineParser::switchToArgMap [private] |
Definition at line 297 of file CmdLineParser.h.
Referenced by AddOption(), Dump(), GetOptArg(), IsOpt(), IsOptArg(), and Reset().