Unity Scopes API
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 #pragma once
20 
21 #include <unity/scopes/FilterBase.h>
22 #include <unity/scopes/Variant.h>
23 
24 namespace unity
25 {
26 
27 namespace scopes
28 {
29 
30 class FilterState;
31 
32 namespace internal
33 {
34 class RangeInputFilterImpl;
35 }
36 
37 namespace experimental
38 {
39 
43 class UNITY_API RangeInputFilter : public FilterBase
44 {
45 public:
47  UNITY_DEFINES_PTRS(RangeInputFilter);
49 
58  static RangeInputFilter::SPtr create(std::string const& id, std::string const& start_label, std::string const& end_label, std::string const& unit_label = "");
59 
64  std::string start_label() const;
65 
70  std::string end_label() const;
71 
76  std::string unit_label() const;
77 
84  bool has_start_value(FilterState const& filter_state) const;
85 
92  bool has_end_value(FilterState const& filter_state) const;
93 
100  double start_value(FilterState const& filter_state) const;
101 
108  double end_value(FilterState const& filter_state) const;
109 
123  void update_state(FilterState& filter_state, Variant const& start_value, Variant const& end_value) const;
124 
139  static void update_state(FilterState& filter_state, std::string const& filter_id, Variant const& start_value, Variant const& end_value);
140 
141 private:
142  RangeInputFilter(internal::RangeInputFilterImpl*);
143  internal::RangeInputFilterImpl* fwd() const;
144  friend class internal::RangeInputFilterImpl;
145 };
146 
147 } // namespace experimental
148 
149 } // namespace scopes
150 
151 } // namespace unity
Top-level namespace for all things Unity-related.
Definition: Version.h:49
Definition: ActionMetadata.h:31