38#include "blocxx/BLOCXX_config.h"
77 bool operator()(
const CmdLineParser::Option&
x)
const
111 if ((
arg.length() >= 2) && (
arg[0] ==
'-'))
121 size_t idx =
arg.indexOf(
'=');
155 val =
theOpt->defaultValue;
158 const char*
p = ::strchr(
arg.c_str(),
'=');
312 return usage.releaseString();
323 return ci->second[
ci->second.size()-1];
336 return ci->second[
ci->second.size()-1];
#define BLOCXX_ASSERT(CON)
BLOCXX_ASSERT works similar to the assert() macro, but instead of calling abort(),...
#define BLOCXX_DEFINE_EXCEPTION_WITH_ID(NAME)
Define a new exception class named <NAME>Exception that derives from Exception.
#define BLOCXX_THROW_ERR(exType, msg, err)
Throw an exception using FILE and LINE.
void push_back(const T &x)
Append an element to the end of the Array.
StringArray getOptionValueList(int id) const
Read out all occurences of a string option.
String getOptionValue(int id, const char *defaultValue="") const
Read out a string option.
CmdLineParser(int argc, char const *const *const argv, const Option *options, EAllowNonOptionArgsFlag allowNonOptionArgs)
bool isSet(int id) const
Read out a boolean option or check for the presence of string option.
String getNonOptionArg(size_t n) const
Read out an non-option argument.
StringArray m_nonOptionArgs
StringArray mustGetOptionValueList(int id, const char *exceptionMessage="") const
Read out all occurences of a string option.
@ E_REQUIRED_ARG
the option requires an argument
@ E_NO_ARG
the option does not take an argument
@ E_OPTIONAL_ARG
the option might have an argument
size_t getNonOptionCount() const
Read the number of arguments that aren't options (but, for example, filenames).
@ E_INVALID_OPTION
an unknown option was specified
@ E_INVALID_NON_OPTION_ARG
a non-option argument was specified, but they are not allowed
@ E_MISSING_ARGUMENT
an option for which argtype == E_REQUIRED_ARG did not have an argument
@ E_MISSING_OPTION
the option wasn't specified
@ E_NON_OPTION_ARGS_INVALID
Non-option arguments are invalid.
String mustGetOptionValue(int id, const char *exceptionMessage="") const
Read out a string option.
optionsMap_t m_parsedOptions
static String getUsage(const Option *options, unsigned int maxColumns=80)
Generate a usage string for the options, for example:
StringArray getNonOptionArgs() const
Read out the non-option args.
const_iterator end() const
size_type count(const key_type &x) const
const_iterator find(const key_type &x) const
container_t::const_iterator const_iterator
This String class is an abstract data type that represents as NULL terminated string of characters.
String substring(size_t beginIndex, size_t length=npos) const
Create another String object that is comprised of a substring of this String object.
bool operator==(const Array< T > &x, const Array< T > &y)
char shortopt
short option char. Set to '\0' for none.