ot::auxil
class CommandLineParser
#include "ot/auxil/CommandLineParser.h"
StringList
typedef std::list< String > StringList
Constructor/Destructor Detail |
CommandLineParser
CommandLineParser()
-
Constructs a CommandLineParser.
addOption
void addOption(CommandLineOption* pOption)
-
getFilenames
StringList getFilenames(int argc,
char* argv,
int firstArg,
int lastArg)
-
getFirstPositionalArg
unsigned getFirstPositionalArg() const
-
getLongOption
protected CommandLineOption& getLongOption(const String& option) const
-
getProgramName
const String& getProgramName() const
-
getShortOption
protected CommandLineOption& getShortOption(char option) const
-
Locates a CommandLineOption that answers to the short option passed.
- Returns:
-
The requested CommandLineOption object
- Exceptions:
CommandLineException
-
if the option is unrecognized or ambiguous
parse
unsigned parse(int argc,
char* argv)
-
Parses the passed command line parameters, extracting any option names and associated arguments.
Parsing is conducted according to POSIX rules. Short option names (defined as a single character) are recognized when prefixed by the short option prefix '-' ('/' is also recognized on Windows platforms).
Parsing stops as soon as a non-option argument is found.
- Returns:
-
the index of the first non-option argument
- Exceptions:
CommandLineException
-
if invalid options have been specified on the command line
Found a bug or missing feature? Please email us at support@elcel.com