Joedb 10.0.0
The Journal-Only Embedded Database
|
Class for conveniently parsing command-line arguments. More...
#include <joedb/ui/Arguments.h>
Public Member Functions | |
Arguments (int argc, const char *const *argv) | |
bool | has_flag (const char *name) |
std::string_view | get_string_option (const char *name, const char *description, const char *default_string) |
size_t | get_enum_option (const char *name, const std::vector< const char * > &labels, size_t default_index) |
template<typename T > | |
T | get_option (const char *name, const char *description, T default_value) |
std::string_view | get_next () |
std::string_view | get_next (const char *parameter) |
bool | peek (const char *s) |
void | add_parameter (const char *parameter) |
std::ostream & | print_help (std::ostream &out) const |
int | get_remaining_count () const |
int | get_index () const |
bool | missing () const |
size_t | size () const |
std::string_view | operator[] (size_t i) const |
All strings passed as input to this class are zero-terminated, so all the std::string_view returned by member functions are zero-terminated. This way, it is safe to use view.data() as zero-terminated string.
Definition at line 18 of file Arguments.h.
joedb::Arguments::Arguments | ( | int | argc, |
const char *const * | argv | ||
) |
Definition at line 27 of file Arguments.cpp.
void joedb::Arguments::add_parameter | ( | const char * | parameter | ) |
Definition at line 138 of file Arguments.cpp.
size_t joedb::Arguments::get_enum_option | ( | const char * | name, |
const std::vector< const char * > & | labels, | ||
size_t | default_index | ||
) |
Definition at line 76 of file Arguments.cpp.
|
inline |
Definition at line 123 of file Arguments.h.
std::string_view joedb::Arguments::get_next | ( | ) |
Definition at line 108 of file Arguments.cpp.
std::string_view joedb::Arguments::get_next | ( | const char * | parameter | ) |
Definition at line 113 of file Arguments.cpp.
|
inline |
Definition at line 92 of file Arguments.h.
|
inline |
Definition at line 122 of file Arguments.h.
std::string_view joedb::Arguments::get_string_option | ( | const char * | name, |
const char * | description, | ||
const char * | default_string | ||
) |
Definition at line 53 of file Arguments.cpp.
bool joedb::Arguments::has_flag | ( | const char * | name | ) |
Definition at line 36 of file Arguments.cpp.
|
inline |
Definition at line 124 of file Arguments.h.
|
inline |
Definition at line 126 of file Arguments.h.
bool joedb::Arguments::peek | ( | const char * | s | ) |
Definition at line 127 of file Arguments.cpp.
std::ostream & joedb::Arguments::print_help | ( | std::ostream & | out | ) | const |
Definition at line 143 of file Arguments.cpp.
|
inline |
Definition at line 125 of file Arguments.h.