![]() |
OpendTect
7.0
|
Public Member Functions | |
| CommandLineParser () | |
| CommandLineParser (const char *) | |
| CommandLineParser (int argc, char **argv) | |
| BufferString | envVarBase () const |
| const OD::String & | getArg (int idx) const |
| const OD::String & | getExecutable () const |
| const OD::String & | getExecutableName () const |
| BufferString | getFullSurveyPath (bool *iscursurv=0) const |
| void | getNormalArguments (BufferStringSet &) const |
| bool | getVal (const char *key, BufferString &, bool acceptnone=false, int valnr=1) const |
| bool | getVal (const char *key, BufferStringSet &, bool acceptnone=false) const |
| bool | getVal (const char *key, DBKey &, bool acceptnone=false, int valnr=1) const |
| bool | getVal (const char *key, FilePath &, bool acceptnone=false, int valnr=1) const |
| template<class T > | |
| bool | getVal (const char *key, T &, bool acceptnone=false, int valnr=1) const |
| template<class T > | |
| bool | getVal (const char *key, TypeSet< T > &, bool acceptnone=false) const |
| bool | hasKey (const char *) const |
| bool | isKey (int) const |
| Does the arg start with - or –. More... | |
| bool | isKeyValue (int idx) const |
| bool | isPresent (const char *) const |
| Is string present as an argument. More... | |
| BufferString | keyedString (const char *ky, int argnr=0) const |
| template<class T > | |
| T | keyedValue (const char *ky, int argnr=0) const |
| const OD::String & | lastArg () const |
| int | nrArgs () const |
| void | setKeyHasValue (const char *key, int nrvals=1) const |
Static Public Member Functions | |
| static void | addFilePath (const char *, BufferString &cmd) |
| static void | addKey (const char *key, BufferString &cmd, const char *valstr=0) |
| adds a space before but not after More... | |
| static BufferString | createKey (const char *key) |
| static void | createKey (const char *key, BufferString &res) |
| static const char * | sDataRootArg () |
| static const char * | sDefTransl () |
| static const char * | sNeedTempSurv () |
| static const char * | sSurveyArg () |
Private Member Functions | |
| void | ensureNrArgs (const char *, int) const |
| int | indexOf (const char *, TypeSet< int > *idxs=nullptr) const |
| void | init (const char *) |
| void | init (int, char **) |
Private Attributes | |
| BufferStringSet | argv_ |
| BufferString | executable_ |
| BufferStringSet | keyswithvalue_ |
| TypeSet< int > | nrvalues_ |
| BufferString | progname_ |
Parser that takes the argc and argv and makes them parsable. An argument starting with – is considered a key, as well as arguments starting with "-", if not imedialtely followed by a number. Hence -create is a key, -9 or -.3 are not.
"bin/my_prog --nriter 4 parfile1.par --fast parfile2.par" can be parsed as follows:
<>
| CommandLineParser::CommandLineParser | ( | const char * | ) |
| CommandLineParser::CommandLineParser | ( | int | argc, |
| char ** | argv | ||
| ) |
| CommandLineParser::CommandLineParser | ( | ) |
Actual command line is used, i.e. the one set by SetProgramArgs
|
static |
adds "\ and \" to protect for spaces in FilePaths
|
static |
adds a space before but not after
|
inlinestatic |
|
inlinestatic |
|
private |
| BufferString CommandLineParser::envVarBase | ( | ) | const |
|
inline |
| const OD::String& CommandLineParser::getExecutable | ( | ) | const |
| const OD::String& CommandLineParser::getExecutableName | ( | ) | const |
| BufferString CommandLineParser::getFullSurveyPath | ( | bool * | iscursurv = 0 | ) | const |
| void CommandLineParser::getNormalArguments | ( | BufferStringSet & | ) | const |
Gets all arguments that are not keys or key-values.
| bool CommandLineParser::getVal | ( | const char * | key, |
| BufferString & | , | ||
| bool | acceptnone = false, |
||
| int | valnr = 1 |
||
| ) | const |
| bool CommandLineParser::getVal | ( | const char * | key, |
| BufferStringSet & | , | ||
| bool | acceptnone = false |
||
| ) | const |
| bool CommandLineParser::getVal | ( | const char * | key, |
| DBKey & | , | ||
| bool | acceptnone = false, |
||
| int | valnr = 1 |
||
| ) | const |
| bool CommandLineParser::getVal | ( | const char * | key, |
| FilePath & | , | ||
| bool | acceptnone = false, |
||
| int | valnr = 1 |
||
| ) | const |
|
inline |
Will parse argument valnr following key. If acceptnone is true, it will only give error if key is found, but no value can be parsed.
|
inline |
| bool CommandLineParser::hasKey | ( | const char * | ) | const |
|
private |
|
private |
|
private |
| bool CommandLineParser::isKey | ( | int | ) | const |
Does the arg start with - or –.
| bool CommandLineParser::isKeyValue | ( | int | idx | ) | const |
True if not a key, and previous is a key that has been set using setKeyHasValue.
| bool CommandLineParser::isPresent | ( | const char * | ) | const |
Is string present as an argument.
|
inline |
|
inline |
| const OD::String& CommandLineParser::lastArg | ( | ) | const |
|
inline |
|
inlinestatic |
|
inlinestatic |
| void CommandLineParser::setKeyHasValue | ( | const char * | key, |
| int | nrvals = 1 |
||
| ) | const |
Tell the parser that the nrvals arguments after key are values. nrvals<1 denotes a variable number of values, running up to the next key. This function is only needed if you will use getNormalArguments.
|
inlinestatic |
|
inlinestatic |
|
private |
|
private |
|
private |
|
private |
|
private |
Generated at for the OpendTect seismic interpretation project. Copyright (C): dGB Beheer B.V. 1995-2024