|
Fancy argparser
Single file argument parser for c++
|
Class which represent actual parsed argument in case of successfully parsing. More...
#include <argparse.h>
Public Member Functions | |
| bool | GetArgumentExists () |
| Does argument exists. | |
| size_t | GetArgumentCount () |
| get actual count of argument, in case of various arguments count. | |
| bool | GetAsBool () const |
| Get result as single bool for bool type arguments. | |
| int | GetAsInt () const |
| Get result as single int for int type arguments. | |
| long long | GetAsLongLong () const |
| Get result as single long long for long long type arguments. | |
| double | GetAsDouble () const |
| Get result as single double for double type arguments. | |
| std::string | GetAsString () const |
| Get result as single string for string type arguments. | |
| std::vector< bool > | GetAsVecBool () const |
| Get result as vector bool for bool type arguments. | |
| std::vector< int > | GetAsVecInt () const |
| Get result as vector int for int type arguments. | |
| std::vector< long long > | GetAsVecLongLong () const |
| Get result as vector long long for long long type arguments. | |
| std::vector< double > | GetAsVecDouble () const |
| Get result as vector double for double type arguments. | |
| std::vector< std::string > | GetAsVecString () const |
| Get result as vector string for string type arguments. | |
Protected Member Functions | |
| ArgumentParsed () | |
Static Protected Member Functions | |
| static void | ThrowIfEmpty (bool empty, const char *getter) |
| Guard for the scalar getters. | |
Protected Attributes | |
| bool | m_exists { false } |
| flag about is argument exists | |
| ArgTypeCast | m_type { ArgTypeCast::e_String } |
| type of argument | |
| size_t | m_count { 0 } |
| count of arguments properties | |
| std::vector< bool > | m_bool = {} |
| container of parsed bool arguments | |
| std::vector< int > | m_int = {} |
| container of parse int arguments | |
| std::vector< long long > | m_longLong = {} |
| container of parsed long long arguments | |
| std::vector< double > | m_double = {} |
| container of parsed double arguments | |
| std::vector< std::string > | m_string = {} |
| container of parsed string arguments | |
| friend | ArgumentsObject |
Class which represent actual parsed argument in case of successfully parsing.
Definition at line 648 of file argparse.h.
|
inlineprotected |
Definition at line 810 of file argparse.h.
|
inline |
get actual count of argument, in case of various arguments count.
Definition at line 660 of file argparse.h.
|
inline |
Does argument exists.
Needed to check in case when argument is not required
Definition at line 653 of file argparse.h.
|
inline |
Get result as single bool for bool type arguments.
Added for c++11 support. Starting from c++17 you can use Get()
| std::out_of_range | if the argument holds no value |
Definition at line 669 of file argparse.h.
|
inline |
Get result as single double for double type arguments.
Added for c++11 support. Starting from c++17 you can use Get()
| std::out_of_range | if the argument holds no value |
Definition at line 700 of file argparse.h.
|
inline |
Get result as single int for int type arguments.
Added for c++11 support. Starting from c++17 you can use Get()
| std::out_of_range | if the argument holds no value |
Definition at line 679 of file argparse.h.
|
inline |
Get result as single long long for long long type arguments.
Added for c++11 support. Starting from c++17 you can use Get()
| std::out_of_range | if the argument holds no value |
Definition at line 689 of file argparse.h.
|
inline |
Get result as single string for string type arguments.
Added for c++11 support. Starting from c++17 you can use Get()
| std::out_of_range | if the argument holds no value |
Definition at line 711 of file argparse.h.
|
inline |
Get result as vector bool for bool type arguments.
Added for c++11 support. Starting from c++17 you can use Get()
Definition at line 721 of file argparse.h.
|
inline |
Get result as vector double for double type arguments.
Added for c++11 support. Starting from c++17 you can use Get()
Definition at line 745 of file argparse.h.
|
inline |
Get result as vector int for int type arguments.
Added for c++11 support. Starting from c++17 you can use Get()
Definition at line 729 of file argparse.h.
|
inline |
Get result as vector long long for long long type arguments.
Added for c++11 support. Starting from c++17 you can use Get()
Definition at line 737 of file argparse.h.
|
inline |
Get result as vector string for string type arguments.
Added for c++11 support. Starting from c++17 you can use Get()
Definition at line 753 of file argparse.h.
|
inlinestaticprotected |
Guard for the scalar getters.
Turns an out-of-bounds front() (undefined behavior) into a clear, catchable exception. Call GetArgumentExists()/GetArgumentCount() first to avoid it.
Definition at line 815 of file argparse.h.
|
protected |
Definition at line 842 of file argparse.h.
|
protected |
container of parsed bool arguments
Definition at line 832 of file argparse.h.
|
protected |
count of arguments properties
Definition at line 829 of file argparse.h.
|
protected |
container of parsed double arguments
Definition at line 838 of file argparse.h.
|
protected |
flag about is argument exists
Definition at line 825 of file argparse.h.
|
protected |
container of parse int arguments
Definition at line 834 of file argparse.h.
|
protected |
container of parsed long long arguments
Definition at line 836 of file argparse.h.
|
protected |
container of parsed string arguments
Definition at line 840 of file argparse.h.
|
protected |
type of argument
Definition at line 827 of file argparse.h.