A message field representable by a std::string. More...
#include <command.hpp>
Public Member Functions | |
void | clear () |
Removes any currently set value for this field. More... | |
std::string | get () const |
If the field has a value, returns a copy of that value; otherwise, returns a default. More... | |
bool | has () const |
True if (and only if) the field has a value. More... | |
operator bool () const | |
Allows casting to a bool to check if the field has a value without directly calling has() . More... | |
void | set (const std::string &value) |
Sets the field to a given value. More... | |
StringField (HebiCommandPtr internal, HebiCommandStringField field) | |
Private Attributes | |
HebiCommandStringField const | field_ |
HebiCommandPtr const | internal_ |
A message field representable by a std::string.
Definition at line 215 of file command.hpp.
hebi::Command::StringField::StringField | ( | HebiCommandPtr | internal, |
HebiCommandStringField | field | ||
) |
Definition at line 167 of file command.cpp.
void hebi::Command::StringField::clear | ( | ) |
Removes any currently set value for this field.
Definition at line 205 of file command.cpp.
std::string hebi::Command::StringField::get | ( | ) | const |
If the field has a value, returns a copy of that value; otherwise, returns a default.
Definition at line 182 of file command.cpp.
bool hebi::Command::StringField::has | ( | ) | const |
True if (and only if) the field has a value.
Definition at line 177 of file command.cpp.
|
explicit |
Allows casting to a bool to check if the field has a value without directly calling has()
.
This can be used as in the following (assuming 'parent' is a parent message, and this field is called 'myField')
Definition at line 172 of file command.cpp.
void hebi::Command::StringField::set | ( | const std::string & | value | ) |
Sets the field to a given value.
Definition at line 198 of file command.cpp.
|
private |
Definition at line 246 of file command.hpp.
|
private |
Definition at line 245 of file command.hpp.