Unity Scopes API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
RangeInputFilter.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_RANGE_INPUT_FILTER_H
20 #define UNITY_SCOPES_RANGE_INPUT_FILTER_H
21 
22 #include <unity/scopes/FilterBase.h>
23 #include <unity/scopes/Variant.h>
24 
25 namespace unity
26 {
27 
28 namespace scopes
29 {
30 
31 class FilterState;
32 
33 namespace internal
34 {
35 class RangeInputFilterImpl;
36 }
37 
41 class UNITY_API RangeInputFilter : public FilterBase
42 {
43 public:
45  UNITY_DEFINES_PTRS(RangeInputFilter);
47 
56  static RangeInputFilter::SPtr create(std::string const& id, std::string const& start_label, std::string const& end_label, std::string const& unit_label = "");
57 
62  std::string start_label() const;
63 
68  std::string end_label() const;
69 
74  std::string unit_label() const;
75 
82  bool has_start_value(FilterState const& filter_state) const;
83 
90  bool has_end_value(FilterState const& filter_state) const;
91 
98  double start_value(FilterState const& filter_state) const;
99 
106  double end_value(FilterState const& filter_state) const;
107 
121  void update_state(FilterState& filter_state, Variant const& start_value, Variant const& end_value) const;
122 
137  static void update_state(FilterState& filter_state, std::string const& filter_id, Variant const& start_value, Variant const& end_value);
138 
139 private:
140  RangeInputFilter(internal::RangeInputFilterImpl*);
141  internal::RangeInputFilterImpl* fwd() const;
142  friend class internal::RangeInputFilterImpl;
143 };
144 
145 } // namespace scopes
146 
147 } // namespace unity
148 
149 #endif
Simple variant class that can hold an integer, boolean, string, double, dictionary, array or null value.
Definition: Variant.h:58
Base class for all implementations of filters.
Definition: FilterBase.h:47
A range filter which allows a start and end value to be entered by user, and any of them is optional...
Definition: RangeInputFilter.h:41
Captures state of multiple filters.
Definition: FilterState.h:47