38#ifndef BLOCXX_CMD_LINE_PARSER_HPP_INCLUDE_GUARD_
39#define BLOCXX_CMD_LINE_PARSER_HPP_INCLUDE_GUARD_
40#include "blocxx/BLOCXX_config.h"
102 CmdLineParser(
int argc,
char const*
const*
const argv,
const Option* options, EAllowNonOptionArgsFlag allowNonOptionArgs);
112 String getOptionValue(
int id,
const char* defaultValue =
"")
const;
125 String mustGetOptionValue(
int id,
const char* exceptionMessage =
"")
const;
144 StringArray mustGetOptionValueList(
int id,
const char* exceptionMessage =
"")
const;
149 bool isSet(
int id)
const;
154 size_t getNonOptionCount ()
const;
160 String getNonOptionArg(
size_t n)
const;
185 static String getUsage(
const Option* options,
unsigned int maxColumns = 80);
191#pragma warning (push)
192#pragma warning (disable: 4251)
#define BLOCXX_DECLARE_APIEXCEPTION(NAME, LINKAGE_SPEC)
Declare a new exception class named <NAME>Exception that derives from Exception This macro is typical...
CmdLineParser(int argc, char const *const *const argv, const Option *options, EAllowNonOptionArgsFlag allowNonOptionArgs)
StringArray m_nonOptionArgs
@ 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
SortedVectorMap< int, StringArray > optionsMap_t
@ 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_ALLOWED
Non-option arguments are allowed.
@ E_NON_OPTION_ARGS_INVALID
Non-option arguments are invalid.
optionsMap_t m_parsedOptions
This String class is an abstract data type that represents as NULL terminated string of characters.
Array< String > StringArray
char shortopt
short option char. Set to '\0' for none.
EArgumentTypeFlag argtype
specifies constraints for the option's argument
const char * longopt
long option string. Set to 0 for none.
const char * description
description used by getUsage(). May be 0.
const char * defaultValue
if argtype == E_OPTIONAL_ARG and no argument is specified, this value will be returned....
int id
unique option id, used to retrieve option values