Ookii.CommandLine for C++
1.0.0
|
Provides options for how to format usage help. More...
#include <ookii/usage_options.h>
Classes | |
struct | defaults |
Provides default values for the fields of basic_usage_options. More... | |
Public Types | |
using | stream_type = std::basic_ostream< CharType, Traits > |
The concrete stream type used. | |
using | string_type = std::basic_string< CharType, Traits, Alloc > |
The concrete string type used. | |
Public Member Functions | |
basic_usage_options () | |
Initializes a new instance of the basic_usage_options class. More... | |
basic_usage_options (stream_type &output) | |
Initializes a new instance of the basic_usage_options class with the specified stream. More... | |
basic_usage_options (stream_type &output, stream_type &error) | |
Initializes a new instance of the basic_usage_options class with the specified output and error streams. More... | |
Public Attributes | |
string_type | alias_format {defaults::alias_format.data()} |
The format to use for the aliases of an argument. More... | |
string_type | alias_separator {defaults::alias_separator.data()} |
The separator to use if the argument has more than one alias. | |
string_type | argument_description_format {defaults::argument_description_format.data()} |
The format to use for the description of an argument. More... | |
size_t | argument_description_indent {defaults::argument_description_indent} |
The level of indentation to use when writing argument descriptions. More... | |
string_type | default_value_format {defaults::default_value_format.data()} |
The format to use for the default value of an argument. More... | |
stream_type & | error |
The stream used to write errors to. | |
bool | include_aliases_in_description {true} |
Indicates whether to include the aliases of arguments in the description. More... | |
bool | include_default_value_in_description {true} |
Indicates whether to include the default value of arguments in the description. More... | |
string_type | multi_value_suffix {defaults::multi_value_suffix.data()} |
Suffix to add to the syntax of multi-value arguments. | |
string_type | optional_argument_format {defaults::optional_argument_format.data()} |
The format to use for the syntax of an optional argument. More... | |
stream_type & | output |
The stream used to write usage help to. | |
size_t | syntax_indent {defaults::syntax_indent} |
The level of indentation to use when writing the usage syntax. More... | |
string_type | usage_prefix_format {defaults::usage_prefix_format.data()} |
The format to use for the prefix to the usage syntax. More... | |
bool | use_white_space_value_separator {true} |
Indicates whether to use white space as the argument name separator in the usage syntax. More... | |
string_type | value_description_format {defaults::value_description_format.data()} |
The format to use for the value description of an argument. More... | |
Provides options for how to format usage help.
This type is used by the basic_command_line_parser to determine how to show errors or usage help.
Two typedefs for common character types are provided:
Type | Definition |
---|---|
ookii::usage_options | ookii::basic_usage_options<char> |
ookii::wusage_options | ookii::basic_usage_options<wchar_t> |
CharType | The character type to use for arguments and other strings. |
Traits | The character traits to use for strings. Defaults to std::char_traits<CharType> . |
Alloc | The allocator to use for strings. Defaults to std::allocator<CharType> . |
|
inline |
Initializes a new instance of the basic_usage_options class.
This instance will write to a line_wrapping_ostream for the standard output stream and the standard input stream.
|
inline |
Initializes a new instance of the basic_usage_options class with the specified stream.
This instance will write both errors and usage to the same stream.
output | The stream used for usage help and errors. |
|
inline |
Initializes a new instance of the basic_usage_options class with the specified output and error streams.
output | The stream used for usage help. |
error | The stream used for errors. |
string_type ookii::basic_usage_options< CharType, Traits, Alloc >::alias_format {defaults::alias_format.data()} |
The format to use for the aliases of an argument.
This value must contain a {}
placeholder for the aliases.
string_type ookii::basic_usage_options< CharType, Traits, Alloc >::argument_description_format {defaults::argument_description_format.data()} |
The format to use for the description of an argument.
This value must contain {}
placeholders for the argument name prefix, the argument name, the value description, the aliases, the description, and the default value of the argument.
The placeholder for the aliases is set to a blank string if the argument has no aliases, or if include_aliases_in_description is false
.
The placeholder for the default value is set to a blank string if the argument has no default value, or if include_default_value_in_description is false
.
size_t ookii::basic_usage_options< CharType, Traits, Alloc >::argument_description_indent {defaults::argument_description_indent} |
The level of indentation to use when writing argument descriptions.
Note that the first line of each argument is not indented.
This value has no effect if the output stream is not using a line_wrapping_streambuf.
string_type ookii::basic_usage_options< CharType, Traits, Alloc >::default_value_format {defaults::default_value_format.data()} |
The format to use for the default value of an argument.
This value must contain a {}
placeholder for the default value.
bool ookii::basic_usage_options< CharType, Traits, Alloc >::include_aliases_in_description {true} |
Indicates whether to include the aliases of arguments in the description.
The default value is true
.
bool ookii::basic_usage_options< CharType, Traits, Alloc >::include_default_value_in_description {true} |
Indicates whether to include the default value of arguments in the description.
The default value is true
.
string_type ookii::basic_usage_options< CharType, Traits, Alloc >::optional_argument_format {defaults::optional_argument_format.data()} |
The format to use for the syntax of an optional argument.
This value must contain a {}
placeholder for the argument name.
size_t ookii::basic_usage_options< CharType, Traits, Alloc >::syntax_indent {defaults::syntax_indent} |
The level of indentation to use when writing the usage syntax.
Note that the first line of the syntax is not indented.
This value has no effect if the output stream is not using a line_wrapping_streambuf.
string_type ookii::basic_usage_options< CharType, Traits, Alloc >::usage_prefix_format {defaults::usage_prefix_format.data()} |
The format to use for the prefix to the usage syntax.
This value must contain a {}
placeholder for the application name.
bool ookii::basic_usage_options< CharType, Traits, Alloc >::use_white_space_value_separator {true} |
Indicates whether to use white space as the argument name separator in the usage syntax.
If false
, the separator specified in basic_parser_builder::argument_name_separator() is used instead. The default value is true
.
If basic_parser_builder::allow_white_space_separator() is set to false
, this value has no effect and the basic_parser_builder::argument_name_separator() is always used.
string_type ookii::basic_usage_options< CharType, Traits, Alloc >::value_description_format {defaults::value_description_format.data()} |
The format to use for the value description of an argument.
This value must contain a {}
placeholder for the value description.