#include <icy/symple/command.h>Inherits:
Message
Symple command message with a node path and action verb.
The node field is a colon-delimited path (e.g. "camera:zoom:in"). Individual path segments can be retrieved with param().
| Return | Name | Description |
|---|---|---|
Command | Constructs an empty command with type set to "command". | |
Command | Constructs a command from a JSON value. | |
Command | Copy constructor. | |
std::string | node const | Returns the colon-delimited node path (e.g. "camera:zoom"). |
std::string | action const | Returns the action verb (defaults to "execute"). |
void | setNode | Sets the node path field. |
void | setAction | Sets the action verb field. |
bool | valid virtual const | Returns true if the base message is valid and the node field is set. |
std::string | param const | Returns the nth colon-separated segment of the node path (1-based). Throws std::out_of_range if n exceeds the number of segments. |
std::vector< std::string > | params | Returns all colon-separated segments of the node path. |
bool | matches const | Returns true if the node path matches the given pattern. Uses wildcard node matching via util::matchNodes. |
Command()Constructs an empty command with type set to "command".
Command(const json::Value & root)Constructs a command from a JSON value.
root JSON object to initialise from.Command(const Command & root)Copy constructor.
root Source command.const
std::string node() constReturns the colon-delimited node path (e.g. "camera:zoom").
const
std::string action() constReturns the action verb (defaults to "execute").
void setNode(std::string_view node)Sets the node path field.
node Colon-delimited node path string.void setAction(std::string_view action)Sets the action verb field.
action Action string (e.g. "execute", "get", "set").virtual const
virtual bool valid() constReturns true if the base message is valid and the node field is set.
const
std::string param(int n) constReturns the nth colon-separated segment of the node path (1-based). Throws std::out_of_range if n exceeds the number of segments.
n 1-based segment index.The nth path segment.
std::vector< std::string > params()Returns all colon-separated segments of the node path.
Vector of path segment strings.
const
bool matches(std::string_view xnode) constReturns true if the node path matches the given pattern. Uses wildcard node matching via util::matchNodes.
xnode Pattern to match against (colon-delimited, supports wildcards).