Ookii.CommandLine for C++
2.0.0
|
Provides the result, success or error, of a command line argument parsing operation. More...
#include <ookii/parse_result.h>
Public Types | |
using | string_provider_type = basic_localized_string_provider< CharType, Traits, Alloc > |
The specialized type of basic_localized_string_provider used. | |
using | string_type = std::basic_string< CharType, Traits, Alloc > |
The concrete string type used by this structure. | |
Public Member Functions | |
parse_result (const string_provider_type &string_provider, parse_error error=parse_error::none, string_type error_arg_name={}) | |
Initializes a new instance of the parse_result structure. More... | |
string_type | get_error_message () const |
Gets a default, English language error message for the current error. More... | |
operator bool () const noexcept | |
Checks if the result was successful. More... | |
Public Attributes | |
parse_error | error |
The type of error that occurred, or parse_error::none to indicate no error. | |
string_type | error_arg_name |
The name of the argument that caused the error, or a blank string if there was no error or the error doesn't relate to a specific argument. | |
const string_provider_type * | string_provider |
The string provider used to get error messages. | |
Provides the result, success or error, of a command line argument parsing operation.
This type is returned from the various basic_command_line_parser::parse() overloads to indicate success or failure. Inspect the value to see if parsing was successful.
CharType | The character type used for argument names and error 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 parse_result structure.
string_provider | The basic_localized_string_provider to use for error messages. |
error | The type of error that occurred, or parse_error::none to indicate no error. |
error_arg_name | The name of the argument that caused the error, or a blank string if there was no error or the error doesn't relate to a specific argument. |
|
inline |
Gets a default, English language error message for the current error.
If appropriate, the message will include the name of the argument that caused the error.
|
inlinenoexcept |
Checks if the result was successful.
true
only if the error is parse_error::none; otherwise, false
.