Unity Scopes API
ValueSliderLabels.h
1 /*
2  * Copyright (C) 2016 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 <string>
22 #include <list>
23 #include <memory>
24 #include <unity/SymbolExport.h>
25 #include <unity/scopes/Variant.h>
26 
27 namespace unity
28 {
29 
30 namespace scopes
31 {
32 
33 namespace internal
34 {
35 class ValueSliderFilterImpl;
36 class ValueSliderLabelsImpl;
37 }
38 
42 typedef std::pair<double, std::string> ValueLabelPair;
43 
47 typedef std::vector<ValueLabelPair> ValueLabelPairList;
48 
56 class UNITY_API ValueSliderLabels final
57 {
58 public:
62  //{@
65  ValueSliderLabels& operator=(ValueSliderLabels const& other);
69 
75  ValueSliderLabels(std::string const& min_label, std::string const& max_label);
76 
89  ValueSliderLabels(std::string const& min_label, std::string const& max_label, ValueLabelPairList const& extra_labels);
90 
95  std::string min_label() const;
96 
101  std::string max_label() const;
102 
106  ValueLabelPairList extra_labels() const;
107 
109  VariantMap serialize() const;
111 
112 private:
113  ValueSliderLabels(internal::ValueSliderLabelsImpl* pimpl);
114  ValueSliderLabels(VariantMap const& var);
115  std::unique_ptr<internal::ValueSliderLabelsImpl> p;
116  friend class internal::ValueSliderLabelsImpl;
117  friend class internal::ValueSliderFilterImpl;
118 };
119 
120 } // namespace scopes
121 
122 } // namespace unity
std::pair< double, std::string > ValueLabelPair
A value and its corresponding label.
Definition: ValueSliderLabels.h:42
Top-level namespace for all things Unity-related.
Definition: Version.h:49
std::map< std::string, Variant > VariantMap
A dictionary of (string, Variant) pairs.
Definition: Variant.h:38
Definition: ActionMetadata.h:31
std::vector< ValueLabelPair > ValueLabelPairList
A sequence of value-label pairs.
Definition: ValueSliderLabels.h:47
Labels used by a ValueSliderFilter.
Definition: ValueSliderLabels.h:56