Ookii.CommandLine for C++
2.0.0
|
Provides information about a subcommand. More...
#include <ookii/subcommand.h>
Public Types | |
using | builder_type = typename command_type::builder_type |
The concrete type of basic_parser_builder used. | |
using | command_type = basic_command< CharType, Traits, Alloc > |
The concrete type of basic_command used. | |
using | command_with_custom_parsing_type = basic_command_with_custom_parsing< CharType, Traits, Alloc > |
The concrete type of basic_command_with_custom_parsing used. | |
using | creator = std::function< std::unique_ptr< command_type >(builder_type *)> |
The type of a function that instantiates a subcommand. | |
using | string_type = std::basic_string< CharType, Traits, Alloc > |
The concrete string type used. | |
Public Member Functions | |
command_info (string_type name, string_type description, creator creator, bool use_custom_argument_parsing=false) | |
Initializes a new instance of the command_info class. More... | |
std::unique_ptr< command_type > | create (builder_type &builder) const |
Creates an instance of the subcommand type. More... | |
std::unique_ptr< command_type > | create_custom_parsing () const |
Creates an instance of the subcommand type for commands that use custom argument parsing. More... | |
const string_type & | description () const noexcept |
Gets the description of the subcommand. | |
const string_type & | name () const noexcept |
Gets the name of the subcommand. | |
bool | use_custom_argument_parsing () const noexcept |
Gets a value that indicates whether the command uses custom argument parsing. More... | |
Static Public Member Functions | |
template<typename T , std::enable_if_t<!std::is_base_of_v< command_with_custom_parsing_type, T >, int > = 0> | |
static command_info | create (string_type name, string_type description) |
Creates a command_info instance for the specified command type. More... | |
template<typename T , std::enable_if_t< std::is_base_of_v< command_with_custom_parsing_type, T >, int > = 0> | |
static command_info | create (string_type name, string_type description) |
Creates a command_info instance for a command type that uses custom argument parsing. More... | |
Provides information about a subcommand.
CharType | The character type used 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 command_info class.
name | The name of the subcommand. |
description | The description of the subcommand. |
creator | A function that instantiates the subcommand. |
use_custom_argument_parsing | Indicates whether this command uses basic_command_with_custom_parsing as a base type. |
|
inline |
Creates an instance of the subcommand type.
builder | The basic_parser_builder to pass to the subcommand type's constructor. |
This function returns nullptr
if this command uses custom argument parsing.
|
inlinestatic |
Creates a command_info instance for the specified command type.
T | The type of the subcommand, which must derive from basic_command. |
name | The name of the subcommand. |
description | The description of the subcommand. |
|
inlinestatic |
Creates a command_info instance for a command type that uses custom argument parsing.
T | The type of the subcommand, which must derive from basic_command. |
name | The name of the subcommand. |
description | The description of the subcommand. |
|
inline |
Creates an instance of the subcommand type for commands that use custom argument parsing.
This function returns nullptr
if this command does not use custom argument parsing.
|
inlinenoexcept |
Gets a value that indicates whether the command uses custom argument parsing.
true
if the command type derives from the basic_command_with_custom_parsing class; otherwise, false
.