Joedb 10.0.0
The Journal-Only Embedded Database
Loading...
Searching...
No Matches
Classes | Public Member Functions | List of all members
joedb::Arguments Class Reference

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 >
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
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ Arguments()

joedb::Arguments::Arguments ( int  argc,
const char *const *  argv 
)

Definition at line 27 of file Arguments.cpp.

Member Function Documentation

◆ add_parameter()

void joedb::Arguments::add_parameter ( const char *  parameter)

Definition at line 138 of file Arguments.cpp.

◆ get_enum_option()

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.

◆ get_index()

int joedb::Arguments::get_index ( ) const
inline

Definition at line 123 of file Arguments.h.

◆ get_next() [1/2]

std::string_view joedb::Arguments::get_next ( )

Definition at line 108 of file Arguments.cpp.

◆ get_next() [2/2]

std::string_view joedb::Arguments::get_next ( const char *  parameter)

Definition at line 113 of file Arguments.cpp.

◆ get_option()

template<typename T >
T joedb::Arguments::get_option ( const char *  name,
const char *  description,
default_value 
)
inline

Definition at line 92 of file Arguments.h.

◆ get_remaining_count()

int joedb::Arguments::get_remaining_count ( ) const
inline

Definition at line 122 of file Arguments.h.

◆ get_string_option()

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.

◆ has_flag()

bool joedb::Arguments::has_flag ( const char *  name)

Definition at line 36 of file Arguments.cpp.

◆ missing()

bool joedb::Arguments::missing ( ) const
inline

Definition at line 124 of file Arguments.h.

◆ operator[]()

std::string_view joedb::Arguments::operator[] ( size_t  i) const
inline

Definition at line 126 of file Arguments.h.

◆ peek()

bool joedb::Arguments::peek ( const char *  s)

Definition at line 127 of file Arguments.cpp.

◆ print_help()

std::ostream & joedb::Arguments::print_help ( std::ostream &  out) const

Definition at line 143 of file Arguments.cpp.

◆ size()

size_t joedb::Arguments::size ( ) const
inline

Definition at line 125 of file Arguments.h.


The documentation for this class was generated from the following files: