Unity Scopes API
|
Metadata passed to scopes for preview and activation. More...
#include <unity/scopes/ActionMetadata.h>
Public Member Functions | |
ActionMetadata (std::string const &locale, std::string const &form_factor) | |
Create ActionMetadata with the given locale and form factor. More... | |
void | set_scope_data (Variant const &data) |
Attach arbitrary data to this ActionMetadata. More... | |
Variant | scope_data () const |
Get data attached to this ActionMetadata. More... | |
void | set_hint (std::string const &key, Variant const &value) |
Sets a hint. More... | |
VariantMap | hints () const |
Get all hints. More... | |
bool | contains_hint (std::string const &key) const |
Check if this SearchMetadata has a hint. More... | |
Variant & | operator[] (std::string const &key) |
Returns a reference to a hint. More... | |
Variant const & | operator[] (std::string const &key) const |
Returns a const reference to a hint. More... | |
Copy and assignment | |
Copy and assignment operators (move and non-move versions) have the usual value semantics. | |
ActionMetadata (ActionMetadata const &other) | |
ActionMetadata (ActionMetadata &&) | |
ActionMetadata & | operator= (ActionMetadata const &other) |
ActionMetadata & | operator= (ActionMetadata &&) |
![]() | |
std::string | locale () const |
Get the locale string. More... | |
std::string | form_factor () const |
Get the form factor string. More... | |
void | set_internet_connectivity (ConnectivityStatus connectivity_status) |
Set internet connectivity status. More... | |
ConnectivityStatus | internet_connectivity () const |
Get internet connectivity status. More... | |
Additional Inherited Members | |
![]() | |
enum | ConnectivityStatus { Unknown, Connected, Disconnected } |
Indicates the internet connectivity status. More... | |
Metadata passed to scopes for preview and activation.
unity::scopes::ActionMetadata::ActionMetadata | ( | std::string const & | locale, |
std::string const & | form_factor | ||
) |
Create ActionMetadata with the given locale and form factor.
locale | locale string, eg. en_EN |
form_factor | form factor name, e.g. phone, desktop, phone-version etc. |
bool unity::scopes::ActionMetadata::contains_hint | ( | std::string const & | key | ) | const |
Check if this SearchMetadata has a hint.
key | The hint name. |
VariantMap unity::scopes::ActionMetadata::hints | ( | ) | const |
Get all hints.
unity::NotFoundException | if no hints are available. |
Variant & unity::scopes::ActionMetadata::operator[] | ( | std::string const & | key | ) |
Returns a reference to a hint.
This method can be used to read or set hints. Setting a value of an existing hint overwrites its previous value. Referencing a non-existing hint automatically creates it with a default value of Variant::Type::Null.
key | The name of the hint. |
Variant const & unity::scopes::ActionMetadata::operator[] | ( | std::string const & | key | ) | const |
Returns a const reference to a hint.
This method can be used for read-only access to hints. Referencing a non-existing hint throws unity::InvalidArgumentException.
key | The name of the hint. |
unity::NotFoundException | if no hint with the given name exists. |
Variant unity::scopes::ActionMetadata::scope_data | ( | ) | const |
Get data attached to this ActionMetadata.
void unity::scopes::ActionMetadata::set_hint | ( | std::string const & | key, |
Variant const & | value | ||
) |
Sets a hint.
key | The name of the hint. |
value | Hint value |
void unity::scopes::ActionMetadata::set_scope_data | ( | Variant const & | data | ) |
Attach arbitrary data to this ActionMetadata.
data | The data value to attach. |