Represents a server control line written to a communication socket. More...
#include <control.hpp>
Public Member Functions | |
control_line (const std::string &str) | |
Parses a control line string. More... | |
bool | empty () const |
Whether the control line is empty. More... | |
operator const std::string & () const | |
Returns the control command. More... | |
const std::string & | cmd () const |
Returns the control command. More... | |
size_t | args_count () const |
Returns the total number of arguments, not including the command itself. More... | |
const std::string & | operator[] (size_t n) const |
Returns the nth argument. More... | |
const std::string & | arg (size_t n) const |
Returns the nth argument. More... | |
std::string | full () const |
Return the full command line string. More... | |
Private Attributes | |
std::vector< std::string > | args_ |
Represents a server control line written to a communication socket.
Control lines are plain text command lines using the ASCII space character (0x20) as command separator. This type is really only used to keep the code pretty.
Definition at line 33 of file control.hpp.
|
inline |
|
inline |
Returns the nth argument.
std::out_of_range | n exceeds args_count(). |
Definition at line 99 of file control.hpp.
References args_, and args_count().
Referenced by operator[]().
|
inline |
Returns the total number of arguments, not including the command itself.
Definition at line 79 of file control.hpp.
References args_.
Referenced by arg(), and campaignd::server::run().
|
inline |
Returns the control command.
Equivalent to calling arg(0).
Definition at line 71 of file control.hpp.
References args_.
Referenced by operator const std::string &().
|
inline |
|
inline |
Return the full command line string.
Definition at line 111 of file control.hpp.
References args_, and utils::join().
Referenced by campaignd::server::run().
|
inline |
Returns the control command.
Equivalent to calling arg(0).
Definition at line 61 of file control.hpp.
References cmd().
|
inline |
Returns the nth argument.
std::out_of_range | n exceeds args_count(). |
Definition at line 89 of file control.hpp.
References arg().
|
private |
Definition at line 117 of file control.hpp.
Referenced by arg(), args_count(), cmd(), control_line(), empty(), and full().