ComPPare 1.0.0
|
Argument parser for plugin command-line arguments. More...
#include <plugin.hpp>
Public Member Functions | |
PluginArgParser (std::string header, bool strict_missing_value=false) | |
PluginArgParser (const PluginArgParser &)=delete | |
PluginArgParser & | operator= (const PluginArgParser &)=delete |
PluginArgParser (PluginArgParser &&)=default | |
PluginArgParser & | operator= (PluginArgParser &&)=default |
~PluginArgParser ()=default | |
std::pair< int, char ** > | parse (int argc, char **argv) |
int | argc () const |
char ** | argv () |
const std::vector< std::string > & | args () const |
Static Private Member Functions | |
static bool | starts_with (const std::string &s, const std::string &prefix) |
static std::vector< std::string > | split_shell_like (const std::string &s) |
static void | append_tokens (std::vector< std::string > &dst, const std::string &value) |
Private Attributes | |
std::string | header_ |
bool | strict_ |
std::vector< std::string > | args_ |
std::vector< char * > | cargv_ |
Argument parser for plugin command-line arguments.
This class is responsible for parsing command-line arguments specific to a plugin. Each plugin can have its own set of arguments, which are prefixed by a unique header. The parser supports both --header=value
and --header value
formats for specifying arguments.
Example usage:
In Command Line:
Then parser.parse(argc, argv)
will extract the quoted values as arguments for the plugin.
|
inlineexplicit |
|
delete |
|
default |
|
default |
|
inlinestaticprivate |
|
inline |
|
inline |
|
inline |
|
delete |
|
default |
|
inline |
|
inlinestaticprivate |
|
inlinestaticprivate |
|
private |
|
private |
|
private |
|
private |