![]() |
appkit
1.5.1
RoadNarrows Robotics Application Kit
|
Helper class to hold a command line execution function. More...
#include <CommandLine.h>
Classes | |
| union | FnVar |
| Union of all variant execution functions. More... | |
Public Member Functions | |
| CmdExec () | |
| Default constructor. | |
| CmdExec (int uid, CmdExec1Func fn) | |
| Variant 1 constructor. More... | |
| CmdExec (int uid, CmdExec2Func fn) | |
| Variant 2 constructor. More... | |
| CmdExec (int uid, CmdExec3Func fn) | |
| Variant 3 constructor. More... | |
| CmdExec (const CmdExec &src) | |
| Copy constructor. More... | |
| int | execute (const str::StringVec &argv) |
| Execute a comamnd with the given arguments. More... | |
| int | execute (CommandLine &cli, const CmdExtArgVec &argv) |
| Execute a comamnd with the given arguments. More... | |
| int | getUid () const |
| Get associated command's unique id. More... | |
Protected Types | |
| enum | Variant { VariantUndef, Variant1, Variant2, Variant3 } |
| Execution function variant enumeration. More... | |
Protected Attributes | |
| int | m_uid |
| command unique id associated with this execution | |
| Variant | m_variant |
| function variant enum | |
| FnVar | m_exec |
| function execution variant | |
Friends | |
| std::ostream & | operator<< (std::ostream &os, const CmdExec &obj) |
| Insert object into output stream. More... | |
Helper class to hold a command line execution function.
Definition at line 164 of file CommandLine.h.
|
protected |
Execution function variant enumeration.
| Enumerator | |
|---|---|
| VariantUndef |
undefined variant |
| Variant1 |
variant 1 |
| Variant2 |
variant 2 |
| Variant3 |
variant 3 |
Definition at line 277 of file CommandLine.h.
|
inline |
Variant 1 constructor.
| uid | Associated command's unique id. |
| fn | Variant 1 execution function. |
Definition at line 183 of file CommandLine.h.
References rnr::cmd::CmdExec::FnVar::fn1, m_exec, m_uid, m_variant, and Variant1.
|
inline |
Variant 2 constructor.
| uid | Associated command's unique id. |
| fn | Variant 2 execution function. |
Definition at line 196 of file CommandLine.h.
References rnr::cmd::CmdExec::FnVar::fn2, m_exec, m_uid, m_variant, and Variant2.
|
inline |
Variant 3 constructor.
| uid | Associated command's unique id. |
| fn | Variant 3 execution function. |
Definition at line 209 of file CommandLine.h.
References rnr::cmd::CmdExec::FnVar::fn3, m_exec, m_uid, m_variant, and Variant3.
|
inline |
Copy constructor.
| src | Source object. |
Definition at line 221 of file CommandLine.h.
References execute(), m_exec, m_uid, and m_variant.
| int CmdExec::execute | ( | const str::StringVec & | argv | ) |
Execute a comamnd with the given arguments.
| argv | The list of string arguments. |
Definition at line 268 of file CommandLine.cxx.
References rnr::cmd::ENoExec.
Referenced by CmdExec(), and rnr::cmd::CommandLine::readCommand().
| int CmdExec::execute | ( | CommandLine & | cli, |
| const CmdExtArgVec & | argv | ||
| ) |
Execute a comamnd with the given arguments.
| cli | Reference to the command-line interface. |
| argv | The list of extended arguments. |
Definition at line 281 of file CommandLine.cxx.
References rnr::cmd::ENoExec, rnr::io::indent(), m_exec, m_uid, m_variant, operator<<(), and rnr::cmd::CmdExec::FnVar::p.
|
inline |
Get associated command's unique id.
Definition at line 258 of file CommandLine.h.
References m_uid, and operator<<.
|
friend |
Insert object into output stream.
| os | Output stream. |
| obj | Object to insert. |
Referenced by rnr::cmd::DataSect::deallocator(), rnr::cmd::CommandLine::end(), and getUid().