Unity Scopes API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Department.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_DEPARTMENT_H
20 #define UNITY_SCOPES_DEPARTMENT_H
21 
22 #include <unity/scopes/Variant.h>
23 #include <unity/util/DefinesPtrs.h>
24 #include <list>
25 #include <string>
26 #include <memory>
27 
28 namespace unity
29 {
30 
31 namespace scopes
32 {
33 
34 class CannedQuery;
35 class Department;
36 
40 typedef std::list<Department> DepartmentList;
41 
42 namespace internal
43 {
44 class DepartmentImpl;
45 }
46 
50 class Department final
51 {
52 public:
54  UNITY_DEFINES_PTRS(Department);
56 
65  Department(CannedQuery const& query, std::string const& label);
66 
78  Department(std::string const& department_id, CannedQuery const& query, std::string const& label);
79 
92  Department(std::string const& department_id, CannedQuery const& query, std::string const& label, DepartmentList const& subdepartments);
93 
97  //{@
98  Department(Department const& other);
100  Department& operator=(Department const& other);
101  Department& operator=(Department&&);
103 
105  ~Department();
107 
112  void set_subdepartments(DepartmentList const& departments);
113 
118  std::string id() const;
119 
124  std::string label() const;
125 
130  CannedQuery query() const;
131 
137 
139  VariantMap serialize() const;
141 
142 private:
143  std::unique_ptr<internal::DepartmentImpl> p;
144 };
145 
146 } // namespace scopes
147 
148 } // namespace unity
149 
150 #endif
std::string label() const
Get the label of this department.
Definition: Department.cpp:82
void set_subdepartments(DepartmentList const &departments)
Set sub-departments of this department.
Definition: Department.cpp:72
std::string id() const
Get the identifier of this department.
Definition: Department.cpp:77
std::list< Department > DepartmentList
List of departments (see unity::scopes::Department)
Definition: Department.h:40
std::map< std::string, Variant > VariantMap
A dictionary of (string, Variant) pairs.
Definition: Variant.h:39
A department with optional sub-departments.
Definition: Department.h:50
Parameters of a search query.
Definition: CannedQuery.h:46
CannedQuery query() const
Get the canned query associated with this department.
Definition: Department.cpp:87
DepartmentList subdepartments() const
Get list of sub-departments of this department.
Definition: Department.cpp:92
Department(CannedQuery const &query, std::string const &label)
Create a department with the given canned query and name.
Definition: Department.cpp:29