Unity Scopes API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
SearchReply.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: Michi Henning <michi.henning@canonical.com>
17  */
18 
19 #ifndef UNITY_SCOPES_SEARCHREPLY_H
20 #define UNITY_SCOPES_SEARCHREPLY_H
21 
22 #include <unity/scopes/Category.h>
23 #include <unity/scopes/CategoryRenderer.h>
24 #include <unity/scopes/Department.h>
25 #include <unity/scopes/FilterBase.h>
26 #include <unity/scopes/FilterState.h>
27 #include <unity/scopes/Reply.h>
28 
29 namespace unity
30 {
31 
32 namespace scopes
33 {
34 
35 class CategorisedResult;
36 class Annotation;
37 
42 class SearchReply : public virtual Reply
43 {
44 public:
53  virtual void register_departments(DepartmentList const& departments, std::string current_department_id = "") = 0;
54 
61  virtual Category::SCPtr register_category(std::string const& id,
62  std::string const& title,
63  std::string const &icon,
64  CategoryRenderer const& renderer_template = CategoryRenderer()) = 0;
65 
70  virtual void register_category(Category::SCPtr category) = 0;
71 
76  virtual Category::SCPtr lookup_category(std::string const& id) = 0;
77 
89  virtual bool push(CategorisedResult const& result) = 0;
90 
99  virtual bool register_annotation(Annotation const& annotation) = 0;
100 
105  virtual bool push(Filters const& filters, FilterState const& filter_state) = 0;
106 
112  virtual ~SearchReply();
113 
114 protected:
116  SearchReply();
118 };
119 
120 } // namespace scopes
121 
122 } // namespace unity
123 
124 #endif
virtual void register_departments(DepartmentList const &departments, std::string current_department_id="")=0
Register departments for the current search reply and provide the current department.
Query link(s) that result in a new search query when clicked by the user.
Definition: Annotation.h:45
std::list< FilterBase::SCPtr > Filters
List of filters.
Definition: FilterBase.h:83
A category renderer template in JSON format.
Definition: CategoryRenderer.h:84
virtual bool register_annotation(Annotation const &annotation)=0
Register an annotation.
std::list< Department > DepartmentList
List of departments (see unity::scopes::Department)
Definition: Department.h:40
Allows query termination to be sent to the source of a query.
Definition: Reply.h:37
virtual Category::SCPtr lookup_category(std::string const &id)=0
Returns a previously registered category.
virtual ~SearchReply()
Destroys a Reply.
Allows the results of a search query to be sent to the query source.
Definition: SearchReply.h:42
virtual bool push(CategorisedResult const &result)=0
Sends a single result to the source of a query.
Captures state of multiple filters.
Definition: FilterState.h:47
virtual Category::SCPtr register_category(std::string const &id, std::string const &title, std::string const &icon, CategoryRenderer const &renderer_template=CategoryRenderer())=0
Register an existing category instance and send it to the source of the query.
A result, including the category it belongs to.
Definition: CategorisedResult.h:41
virtual std::string category()=0
Returns the category of the target object of this proxy.