Unity Scopes API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
SwitchFilter.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_SWITCHFILTER_H
20 #define UNITY_SCOPES_SWITCHFILTER_H
21 
22 #include <unity/scopes/FilterBase.h>
23 
24 namespace unity
25 {
26 
27 namespace scopes
28 {
29 
30 class FilterState;
31 
32 namespace internal
33 {
34 class SwitchFilterImpl;
35 }
36 
37 namespace experimental
38 {
39 
45 class UNITY_API SwitchFilter : public FilterBase
46 {
47 public:
49  UNITY_DEFINES_PTRS(SwitchFilter);
51 
58  static SwitchFilter::UPtr create(std::string const& id, std::string const& label);
59 
64  std::string label() const;
65 
74  bool is_on(FilterState const& filter_state) const;
75 
82  void update_state(FilterState& filter_state, bool active) const;
83 
90  static void update_state(FilterState& filter_state, std::string const& filter_id, bool active);
91 
92 private:
93  SwitchFilter(internal::SwitchFilterImpl*);
94  internal::SwitchFilterImpl* fwd() const;
95  friend class internal::SwitchFilterImpl;
96 };
97 
98 } // namespace experimental
99 
100 } // namespace scopes
101 
102 } // namespace unity
103 
104 #endif