Unity Scopes API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
ListenerBase.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_LISTENERBASE_H
20 #define UNITY_SCOPES_LISTENERBASE_H
21 
22 #include <unity/util/DefinesPtrs.h>
23 #include <unity/util/NonCopyable.h>
24 
25 #include <string>
26 
27 namespace unity
28 {
29 
30 namespace scopes
31 {
32 
33 //TODO: fix doc
43 {
44 public:
46  NONCOPYABLE(ListenerBase);
47  UNITY_DEFINES_PTRS(ListenerBase);
48 
49  virtual ~ListenerBase();
51 
58  enum Reason { Finished, Cancelled, Error };
59 
70  virtual void finished(Reason r, std::string const& error_message) = 0;
71 
72 protected:
74  ListenerBase();
76 };
77 
82 char const* to_string(ListenerBase::Reason reason);
83 
84 } // namespace scopes
85 
86 } // namespace unity
87 
88 #endif
Reason
Indicates the cause of a call to finished().
Definition: ListenerBase.h:58
char const * to_string(ListenerBase::Reason reason)
Convenience function to convert a ListenerBase::Reason enumerator to a string.
virtual void finished(Reason r, std::string const &error_message)=0
Called once by the scopes run time after the final result for a query() was sent. ...
Abstract base class to be notified of query completion.
Definition: ListenerBase.h:42