1 #ifndef commandlineparser_h 2 #define commandlineparser_h 54 CommandLineParser(
const char*);
55 CommandLineParser(
int argc,
char** argv);
60 void setKeyHasValue(
const char* key,
int nrvals=1);
70 bool hasKey(
const char*)
const;
72 bool acceptnone=
false,
int valnr=1)
const;
73 template <
class T>
bool getVal(
const char* key,T&,
74 bool acceptnone=
false,
int valnr=1)
const;
80 bool isPresent(
const char*)
const;
83 int nrArgs()
const {
return argv_.size(); }
87 bool isKey(
int)
const;
89 bool isKeyValue(
int idx)
const;
100 { res =
"--"; res += key; }
102 const char* valstr=0);
111 int indexOf(
const char*)
const;
112 void init(
int,
char**);
113 void init(
const char*);
125 template <
class T>
inline 127 bool acceptnone,
int valnr )
const 129 const int keyidx =
indexOf( key );
133 const int validx = keyidx +
mMAX(valnr,1);
#define mExpClass(module)
Definition: commondefs.h:160
bool getFromString(int &, const char *, int udfval)
static void createKey(const char *key, BufferString &res)
Definition: commandlineparser.h:99
BufferStringSet keyswithvalue_
Definition: commandlineparser.h:119
BufferString executable_
Definition: commandlineparser.h:116
Set of BufferString objects.
Definition: bufstringset.h:28
ObjectSet< T >::size_type indexOf(const ObjectSet< T > &os, const S &val)
Locate object in set.
Definition: objectset.h:169
int indexOf(const char *) const
Definition: commandlineparser.h:51
TypeSet< int > nrvalues_
Definition: commandlineparser.h:120
bool isKey(int) const
Does the arg start with - or –.
#define mUdf(type)
Use this macro to get the undefined for simple types.
Definition: undefval.h:272
encapsulates the read-access-only part of strings in OD.
Definition: odstring.h:31
const OD::String & getArg(int idx) const
Definition: commandlineparser.h:93
BufferStringSet argv_
Definition: commandlineparser.h:117
bool getVal(const char *key, BufferString &, bool acceptnone=false, int valnr=1) const
OD::String with its own variable length buffer. The buffer has a guaranteed minimum size...
Definition: bufstring.h:40
int nrArgs() const
Definition: commandlineparser.h:83
virtual bool validIdx(int64_t) const
Definition: objectset.h:302
BufferString progname_
Definition: commandlineparser.h:115
#define mMAX(x, y)
Definition: commondefs.h:48