![]() |
XII Release 0.1.0
|
xiiCommandLineOptionDoc can be used to document a command line option whose logic might be more complex than what the other option types provide. More...
#include <CommandLineOptions.h>
Public Member Functions | |
xiiCommandLineOptionDoc (xiiStringView sSortingGroup, xiiStringView sArgument, xiiStringView sParamShortDesc, xiiStringView sLongDesc, xiiStringView sDefaultValue, bool bCaseSensitive=false) | |
virtual void | GetOptions (xiiStringBuilder &ref_sOut) const override |
Writes all the supported options (e.g. '-arg') to 'out'. If more than one option is allowed, they should be separated with semicolons or pipes. | |
virtual void | GetParamShortDesc (xiiStringBuilder &ref_sOut) const override |
Returns a very short description of the option (type). For example "<int>" or "<enum>". | |
virtual void | GetParamDefaultValueDesc (xiiStringBuilder &ref_sOut) const override |
Returns a very short string for the options default value. For example "0" or "auto". | |
virtual void | GetLongDesc (xiiStringBuilder &ref_sOut) const override |
Returns a proper description of the option. | |
virtual xiiStringView | GetType () override |
Returns "Doc". | |
bool | IsOptionSpecified (xiiStringBuilder *out_pWhich=nullptr, const xiiCommandLineUtils *pUtils=xiiCommandLineUtils::GetGlobalInstance()) const |
Checks whether any of the option variants is set on the command line, and returns which one. For example '-h' or '-help'. | |
![]() | |
xiiCommandLineOption (xiiStringView sSortingGroup) | |
virtual void | GetSortingGroup (xiiStringBuilder &ref_sOut) const |
Writes the sorting group name to 'out'. | |
void | GetSplitOptions (xiiStringBuilder &out_sAll, xiiDynamicArray< xiiStringView > &ref_splitOptions) const |
Returns the supported option names (e.g. '-arg') as split strings. | |
Protected Member Functions | |
bool | ShouldLog (LogMode mode, bool bWasSpecified) const |
void | LogOption (xiiStringView sOption, xiiStringView sValue, bool bWasSpecified) const |
Protected Attributes | |
xiiStringView | m_sArgument |
xiiStringView | m_sParamShortDesc |
xiiStringView | m_sParamDefaultValue |
xiiStringView | m_sLongDesc |
bool | m_bCaseSensitive = false |
bool | m_bLoggedOnce = false |
![]() | |
xiiStringView | m_sSortingGroup |
![]() | |
xiiEnumerable * | m_pNextInstance |
Additional Inherited Members | |
![]() | |
enum class | LogAvailableModes { Always , IfHelpRequested } |
enum class | LogMode { Never , FirstTime , FirstTimeIfSpecified , Always , AlwaysIfSpecified } |
Describes whether the value of an option (and whether something went wrong), should be printed to xiiLog. More... | |
![]() | |
static bool | IsHelpRequested (const xiiCommandLineUtils *pUtils=xiiCommandLineUtils::GetGlobalInstance()) |
Checks whether a command line was passed that requests help output. | |
static xiiResult | RequireOptions (xiiStringView sRequiredOptions, xiiString *pMissingOption=nullptr, const xiiCommandLineUtils *pUtils=xiiCommandLineUtils::GetGlobalInstance()) |
Checks whether all required options are passed to the command line. | |
static bool | LogAvailableOptions (LogAvailableModes mode, xiiStringView sGroupFilter={}, const xiiCommandLineUtils *pUtils=xiiCommandLineUtils::GetGlobalInstance()) |
Prints all available options to the xiiLog. | |
static bool | LogAvailableOptionsToBuffer (xiiStringBuilder &out_sBuffer, LogAvailableModes mode, xiiStringView sGroupFilter={}, const xiiCommandLineUtils *pUtils=xiiCommandLineUtils::GetGlobalInstance()) |
Same as LogAvailableOptions() but captures the output from xiiLog and returns it in a xiiStringBuilder. | |
![]() | |
static const xiiRTTI * | GetStaticRTTI () |
xiiCommandLineOptionDoc can be used to document a command line option whose logic might be more complex than what the other option types provide.
This class is meant to be used for options that are actually queried directly through xiiCommandLineUtils, but should still show up in the command line option documentation, such that the user can discover them.
|
overridevirtual |
Returns a proper description of the option.
The long description is allowed to contain newlines (
) and the output will be formatted accordingly.
Implements xiiCommandLineOption.
|
overridevirtual |
Writes all the supported options (e.g. '-arg') to 'out'. If more than one option is allowed, they should be separated with semicolons or pipes.
Implements xiiCommandLineOption.
|
overridevirtual |
Returns a very short string for the options default value. For example "0" or "auto".
Implements xiiCommandLineOption.
Reimplemented in xiiCommandLineOptionEnum, xiiCommandLineOptionFloat, and xiiCommandLineOptionInt.
|
overridevirtual |
Returns a very short description of the option (type). For example "<int>" or "<enum>".
Implements xiiCommandLineOption.
Reimplemented in xiiCommandLineOptionEnum, xiiCommandLineOptionFloat, and xiiCommandLineOptionInt.
|
inlineoverridevirtual |
Returns "Doc".
Implements xiiCommandLineOption.
Reimplemented in xiiCommandLineOptionBool, xiiCommandLineOptionEnum, xiiCommandLineOptionFloat, xiiCommandLineOptionInt, xiiCommandLineOptionPath, and xiiCommandLineOptionString.