Unity Scopes API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
ActionMetadata.h
1 /*
2  * Copyright (C) 2014 Canonical Ltd
3  *
4  * This program is free software: you can redistribute it and/or modify
5  * it under the terms of the GNU Lesser General Public License version 3 as
6  * published by the Free Software Foundation.
7  *
8  * This program is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  * GNU Lesser General Public License for more details.
12  *
13  * You should have received a copy of the GNU Lesser General Public License
14  * along with this program. If not, see <http://www.gnu.org/licenses/>.
15  *
16  * Authored by: Pawel Stolowski <pawel.stolowski@canonical.com>
17  */
18 
19 #ifndef UNITY_SCOPES_ACTIONMETADATA_H
20 #define UNITY_SCOPES_ACTIONMETADATA_H
21 
22 #include <unity/scopes/QueryMetadata.h>
23 #include <unity/scopes/Variant.h>
24 #include <unity/util/DefinesPtrs.h>
25 
26 namespace unity
27 {
28 
29 namespace scopes
30 {
31 
32 namespace internal
33 {
34 class ActionMetadataImpl;
35 }
36 
43 {
44 public:
46  UNITY_DEFINES_PTRS(ActionMetadata);
47 
48  ~ActionMetadata();
50 
56  ActionMetadata(std::string const& locale, std::string const& form_factor);
57 
62  void set_scope_data(Variant const& data);
63 
68  Variant scope_data() const;
69 
73  //{@
74  ActionMetadata(ActionMetadata const& other);
76 
77  ActionMetadata& operator=(ActionMetadata const& other);
78  ActionMetadata& operator=(ActionMetadata&&);
80 
81 private:
82  ActionMetadata(internal::ActionMetadataImpl* impl);
83  friend class internal::ActionMetadataImpl;
84 };
85 
86 } // namespace scopes
87 
88 } // namespace unity
89 
90 #endif
std::string form_factor() const
Get the form factor string.
Definition: QueryMetadata.cpp:61
Simple variant class that can hold an integer, boolean, string, double, dictionary, array or null value.
Definition: Variant.h:58
std::string locale() const
Get the locale string.
Definition: QueryMetadata.cpp:56
Metadata passed to scopes for preview and activation.
Definition: ActionMetadata.h:42
ActionMetadata(std::string const &locale, std::string const &form_factor)
Create ActionMetadata with the given locale and form factor.
Definition: ActionMetadata.cpp:29
Variant scope_data() const
Get data attached to this ActionMetadata.
Definition: ActionMetadata.cpp:69
Base class for extra metadata passed to scopes as a part of a request.
Definition: QueryMetadata.h:41
void set_scope_data(Variant const &data)
Attach arbitrary data to this ActionMetadata.
Definition: ActionMetadata.cpp:64