Unity Scopes API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Category.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_CATEGORY_H
20 #define UNITY_SCOPES_CATEGORY_H
21 
22 #include <unity/util/NonCopyable.h>
23 #include <unity/util/DefinesPtrs.h>
24 #include <unity/scopes/Variant.h>
25 #include <string>
26 #include <memory>
27 
28 namespace unity
29 {
30 
31 namespace scopes
32 {
33  class CategoryRenderer;
34 
35 namespace internal
36 {
37  class CategoryImpl;
38  class CategoryRegistry;
39 }
40 
48 class Category
49 {
50 public:
52  NONCOPYABLE(Category);
53  UNITY_DEFINES_PTRS(Category);
54 
55  virtual ~Category();
57 
62  std::string id() const;
63 
68  std::string title() const;
69 
74  std::string icon() const;
75 
80  CategoryRenderer const& renderer_template() const;
81 
82  // @cond
83  VariantMap serialize() const;
84  // @endcond
85 
86 protected:
88  Category(std::string const& id, std::string const& title, std::string const &icon, CategoryRenderer const& renderer_template);
89  Category(VariantMap const& variant_map);
91 
92  friend class internal::CategoryRegistry;
93 
94 private:
95  std::unique_ptr<internal::CategoryImpl> p;
96 };
97 
98 } // namespace scopes
99 
100 } // namespace unity
101 
102 #endif
std::string icon() const
Get icon of this Category.
A category renderer template in JSON format.
Definition: CategoryRenderer.h:84
std::string title() const
Get title of this Category.
std::string id() const
Get identifier of this Category.
A set of related results returned by a scope and displayed within a single pane in the Unity dash...
Definition: Category.h:48
CategoryRenderer const & renderer_template() const
Get renderer template of this Category.
std::map< std::string, Variant > VariantMap
A dictionary of (string, Variant) pairs.
Definition: Variant.h:39