ActionMetadata

Metadata passed to scopes for preview and activation. More...

#include <unity/scopes/ActionMetadata.h>

Inheritance diagram for unity::scopes::ActionMetadata:
Inheritance graph
[legend]

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...
 
Variantoperator[] (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 &&)
 
ActionMetadataoperator= (ActionMetadata const &other)
 
ActionMetadataoperator= (ActionMetadata &&)
 

Additional Inherited Members

 Indicates the internet connectivity status. More...

Detailed Description

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
localelocale string, eg. en_EN
form_factorform 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
keyThe hint name.
Returns
True if the hint is set.
VariantMap unity::scopes::ActionMetadata::hints ( ) const

Get all hints.

Returns
Hints dictionary.
Exceptions
unity::NotFoundExceptionif 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
keyThe 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
keyThe name of the hint.
Returns
A const reference to the hint.
Exceptions
unity::NotFoundExceptionif 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
keyThe name of the hint.
valueHint value
void unity::scopes::ActionMetadata::set_scope_data ( Variant const &  data)

Attach arbitrary data to this ActionMetadata.

Parameters
dataThe data value to attach.