unity.scopes.ActionMetadata
Metadata passed to scopes for preview and activation. More...
#include <unity/scopes/ActionMetadata.h>
Inheritance diagram for unity::scopes::ActionMetadata: src="https://assets.ubuntu.com/v1/053a90f0-classunity_1_1scopes_1_1_action_metadata__inherit__graph.png" border="0" alt="Inheritance graph"/>
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 &&) |
src="https://assets.ubuntu.com/v1/c6607712-closed.png" alt="-"/> Public Member Functions inherited from unity::scopes::QueryMetadata | |
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 | |
src="https://assets.ubuntu.com/v1/c6607712-closed.png" alt="-"/> Public Types inherited from unity::scopes::QueryMetadata | |
enum | ConnectivityStatus { Unknown, Connected, Disconnected } |
Indicates the internet connectivity status. More... | |
Detailed Description
Metadata passed to scopes for preview and activation.
- See also
- unity::scopes::ScopeBase::preview, unity::scopes::ScopeBase::activate, unity::scopes::ScopeBase::perform_action
Constructor & Destructor Documentation
unity::scopes::ActionMetadata::ActionMetadata | ( | std::string const & | locale, |
std::string const & | form_factor | ||
) |
Create ActionMetadata with the given locale and form factor.
- Parameters
-
locale locale string, eg. en_EN form_factor form factor name, e.g. phone, desktop, phone-version etc.
Member Function Documentation
bool unity::scopes::ActionMetadata::contains_hint | ( | std::string const & | key | ) | const |
Check if this SearchMetadata has a hint.
- Parameters
-
key The hint name.
- Returns
- True if the hint is set.
VariantMap unity::scopes::ActionMetadata::hints | ( | ) | const |
Get all hints.
- Returns
- Hints dictionary.
- Exceptions
-
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.
- Parameters
-
key The name of the hint.
- Returns
- A reference to 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.
- Parameters
-
key The name of the hint.
- Returns
- A const reference to the hint.
- Exceptions
-
unity::NotFoundException if no hint with the given name exists.
Variant unity::scopes::ActionMetadata::scope_data | ( | ) | const |
Get data attached to this ActionMetadata.
- Returns
- The attached data, or Variant::null.
void unity::scopes::ActionMetadata::set_hint | ( | std::string const & | key, |
Variant const & | value | ||
) |
Sets a hint.
- Parameters
-
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.
- Parameters
-
data The data value to attach.