Unity Scopes API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Annotation.h
1 /*
2  * Copyright (C) 2013 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_ANNOTATION_H
20 #define UNITY_SCOPES_ANNOTATION_H
21 
22 #include <unity/scopes/Variant.h>
23 #include <unity/scopes/Link.h>
24 #include <unity/util/DefinesPtrs.h>
25 #include <list>
26 #include <memory>
27 
28 namespace unity
29 {
30 
31 namespace scopes
32 {
33 class CannedQuery;
34 
35 namespace internal
36 {
37 class AnnotationImpl;
38 class ResultReplyObject;
39 }
40 
41 namespace experimental
42 {
43 
48 class Annotation final
49 {
50 public:
52  UNITY_DEFINES_PTRS(Annotation);
54 
58  enum Type
59  {
60  Link,
61  GroupedLink
62  };
63 
68  explicit Annotation(Type atype);
69 
73  //{@
74  Annotation(Annotation const &other);
75  Annotation(Annotation&&);
76  Annotation& operator=(Annotation const& other);
77  Annotation& operator=(Annotation&&);
79 
81  virtual ~Annotation();
83 
87  void set_label(std::string const& label);
88 
92  void set_icon(std::string const& icon);
93 
100  void add_link(std::string const& label, CannedQuery const& query);
101 
106  std::string label() const;
107 
112  std::string icon() const;
113 
118  std::list<Link::SCPtr> links() const;
119 
124  Type annotation_type() const;
125 
127  VariantMap serialize() const;
129 
130 private:
131  Annotation(internal::AnnotationImpl* impl);
132  std::unique_ptr<internal::AnnotationImpl> p;
133 
134  friend class internal::ResultReplyObject;
135 };
136 
137 } // namespace experimental
138 
139 } // namespace scopes
140 
141 } // namespace unity
142 
143 #endif
std::map< std::string, Variant > VariantMap
A dictionary of (string, Variant) pairs.
Definition: Variant.h:39