Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | List of all members
swarmio::tool::Command Class Referencefinal

Parser for commands of the default form. More...

#include <Command.h>

Public Member Functions

const std::map< std::string, std::string > & GetParameters () const
 Get the map of parameters. More...
 
const std::string & GetPath () const
 Get the path. More...
 
const std::string & GetVerb () const
 Get the verb. More...
 
bool HasParameters () const
 Does the command have parameters? More...
 
bool HasPath () const
 Does the command have a path specified? More...
 
bool Is (const char *pattern) const
 Do a case insensitive regex match on the verb. More...
 

Static Public Member Functions

static void HighlighterCallback (const std::string &input, replxx::Replxx::colors_t &colors, void *unused)
 Highlighter callback for commands. More...
 
static Command Parse (std::string command)
 Parse a string as a command. More...
 

Private Member Functions

 Command (const std::string &verb)
 Construct a new Command object. More...
 

Private Attributes

std::map< std::string, std::string > _parameters
 Parameters. More...
 
std::string _path
 Path. More...
 
std::string _verb
 Verb. More...
 

Detailed Description

Parser for commands of the default form.

Basic format is: VERB [PATH] [NAME=VALUE]...

Definition at line 15 of file Command.h.

Constructor & Destructor Documentation

swarmio::tool::Command::Command ( const std::string &  verb)
inlineprivate

Construct a new Command object.

Parameters
verbVerb

Definition at line 42 of file Command.h.

Member Function Documentation

const std::map<std::string, std::string>& swarmio::tool::Command::GetParameters ( ) const
inline

Get the map of parameters.

Returns
const std::map&

Definition at line 119 of file Command.h.

const std::string& swarmio::tool::Command::GetPath ( ) const
inline

Get the path.

Returns
const std::string&

Definition at line 109 of file Command.h.

const std::string& swarmio::tool::Command::GetVerb ( ) const
inline

Get the verb.

Returns
const std::string&

Definition at line 99 of file Command.h.

bool swarmio::tool::Command::HasParameters ( ) const
inline

Does the command have parameters?

Returns
True if parameters were specified

Definition at line 89 of file Command.h.

bool swarmio::tool::Command::HasPath ( ) const
inline

Does the command have a path specified?

Returns
True if a path was specified

Definition at line 79 of file Command.h.

void Command::HighlighterCallback ( const std::string &  input,
replxx::Replxx::colors_t &  colors,
void *  unused 
)
static

Highlighter callback for commands.

Parameters
inputInput string
colorsColors
unusedUnused parameter

Definition at line 8 of file Command.cpp.

bool Command::Is ( const char *  pattern) const

Do a case insensitive regex match on the verb.

Parameters
patternRegex pattern

Definition at line 229 of file Command.cpp.

Command Command::Parse ( std::string  command)
static

Parse a string as a command.

Parameters
commandCommand string
Returns
Command

Definition at line 108 of file Command.cpp.

Member Data Documentation

std::map<std::string, std::string> swarmio::tool::Command::_parameters
private

Parameters.

Definition at line 35 of file Command.h.

std::string swarmio::tool::Command::_path
private

Path.

Definition at line 29 of file Command.h.

std::string swarmio::tool::Command::_verb
private

Verb.

Definition at line 23 of file Command.h.


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


swarmros
Author(s):
autogenerated on Fri Apr 3 2020 03:42:48