Unity Scopes API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
FilterState.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_FILTERSTATE_H
20 #define UNITY_SCOPES_FILTERSTATE_H
21 
22 #include <unity/scopes/Variant.h>
23 #include <unity/util/DefinesPtrs.h>
24 #include <memory>
25 
26 namespace unity
27 {
28 
29 namespace scopes
30 {
31 
32 class FilterBase;
33 
34 namespace internal
35 {
36 class FilterStateImpl;
37 class FilterBaseImpl;
38 }
39 
47 class FilterState final
48 {
49 public:
51  UNITY_DEFINES_PTRS(FilterState);
52 
53  ~FilterState();
54  VariantMap serialize() const;
56 
60  FilterState();
61 
65  //{@
66  FilterState(FilterState const& other);
68  FilterState& operator=(FilterState const& other);
69  FilterState& operator=(FilterState&& other);
71 
76  bool has_filter(std::string const& id) const;
77 
82  void remove(std::string const& id);
83 
84 private:
85  FilterState(internal::FilterStateImpl *pimpl);
86  std::unique_ptr<internal::FilterStateImpl> p;
87  friend class internal::FilterBaseImpl;
88  friend class internal::FilterStateImpl;
89 };
90 
91 } // namespace scopes
92 
93 } // namespace unity
94 
95 #endif
bool has_filter(std::string const &id) const
Check if state for the given filter has been stored.
Definition: FilterState.cpp:67
std::map< std::string, Variant > VariantMap
A dictionary of (string, Variant) pairs.
Definition: Variant.h:39
Captures state of multiple filters.
Definition: FilterState.h:47
FilterState()
Constructs a an empty filter state instance.
Definition: FilterState.cpp:29