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 
38 namespace experimental
39 {
40 
44 class UNITY_API RangeInputFilter : public FilterBase
45 {
46 public:
48  UNITY_DEFINES_PTRS(RangeInputFilter);
50 
59  static RangeInputFilter::SPtr create(std::string const& id, std::string const& start_label, std::string const& end_label, std::string const& unit_label = "");
60 
65  std::string start_label() const;
66 
71  std::string end_label() const;
72 
77  std::string unit_label() const;
78 
85  bool has_start_value(FilterState const& filter_state) const;
86 
93  bool has_end_value(FilterState const& filter_state) const;
94 
101  double start_value(FilterState const& filter_state) const;
102 
109  double end_value(FilterState const& filter_state) const;
110 
124  void update_state(FilterState& filter_state, Variant const& start_value, Variant const& end_value) const;
125 
140  static void update_state(FilterState& filter_state, std::string const& filter_id, Variant const& start_value, Variant const& end_value);
141 
142 private:
143  RangeInputFilter(internal::RangeInputFilterImpl*);
144  internal::RangeInputFilterImpl* fwd() const;
145  friend class internal::RangeInputFilterImpl;
146 };
147 
148 } // namespace experimental
149 
150 } // namespace scopes
151 
152 } // namespace unity
153 
154 #endif
Top-level namespace for all things Unity-related.
Definition: Version.h:50
Definition: ActionMetadata.h:32