OpenADFortTk (basic)
CmdLineParser Class Reference

#include <CmdLineParser.h>

Collaboration diagram for CmdLineParser:

List of all members.

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)
CmdLineParseroperator= (const CmdLineParser &x)
void Ctor ()
void Reset ()
void CheckForErrors (const OptArgDesc *optArgDescs)
const OptArgDescCreateSortedCopy (const OptArgDesc *optArgDescs)
SwDesc MakeSwitchDesc (const char *str)
const OptArgDescFindOptDesc (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

Detailed Description

Definition at line 88 of file CmdLineParser.h.


Member Typedef Documentation

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.


Member Enumeration Documentation

Enumerator:
DUPOPT_NULL 
DUPOPT_ERR 
DUPOPT_CLOB 
DUPOPT_CAT 

Definition at line 104 of file CmdLineParser.h.

Enumerator:
ARG_NULL 
ARG_NONE 
ARG_REQ 
ARG_OPT 

Definition at line 96 of file CmdLineParser.h.


Constructor & Destructor Documentation

Definition at line 89 of file CmdLineParser.cxx.

References Ctor().

Here is the call graph for this function:

CmdLineParser::CmdLineParser ( const OptArgDesc optArgDescs,
int  argc,
const char *const  argv[] 
)

Definition at line 94 of file CmdLineParser.cxx.

References Ctor(), and Parse().

Here is the call graph for this function:

Definition at line 109 of file CmdLineParser.cxx.

References Reset().

Here is the call graph for this function:

CmdLineParser::CmdLineParser ( const CmdLineParser p) [inline, private]

Definition at line 248 of file CmdLineParser.h.


Member Function Documentation

void CmdLineParser::AddOption ( const OptArgDesc odesc,
const SwDesc swdesc 
) [private]
void CmdLineParser::AddOption ( const OptArgDesc odesc,
const std::string &  sw,
const std::string &  arg 
) [private]
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().

Here is the call graph for this function:

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().

Here is the call graph for this function:

const CmdLineParser::OptArgDesc * CmdLineParser::FindOptDesc ( const OptArgDesc optArgDescs,
const SwDesc swdesc,
bool  errOnMultipleMatches = true 
) [private]
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().

Here is the call graph for this function:

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().

Here is the call graph for this function:

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().

Here is the call graph for this function:

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().

Here is the call graph for this function:

CmdLineParser& CmdLineParser::operator= ( const CmdLineParser x) [inline, private]

Definition at line 249 of file CmdLineParser.h.

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.


Member Data Documentation

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.

Referenced by GetCmd(), and Parse().


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines