~mterry/unity-scopes-api/snap-root

« back to all changes in this revision

Viewing changes to include/unity/scopes/OptionSelectorFilter.h

  • Committer: CI Train Bot
  • Author(s): Pawel Stolowski
  • Date: 2016-03-17 22:35:14 UTC
  • mfrom: (261.1.54 staging)
  • Revision ID: ci-train-bot@canonical.com-20160317223514-dxndlxrg5jbi2oqk
Merged devel: use abigail for abi-compoliance checker (disabled for now due o abigail bugs); filters API changes.
Approved by: Michi Henning, PS Jenkins bot

Show diffs side-by-side

added added

removed removed

Lines of Context:
21
21
#include <unity/scopes/FilterBase.h>
22
22
#include <unity/scopes/FilterOption.h>
23
23
#include <unity/scopes/Variant.h>
 
24
#include <unity/scopes/FilterGroup.h>
24
25
#include <string>
25
26
#include <list>
26
27
#include <set>
51
52
 
52
53
    /**
53
54
    \brief Creates an OpionSelectorFilter.
54
 
    \param id A unique identifier for the filter that can be used to identify it later among several filters.
 
55
    \param id A unique identifier for the filter that can be used to later identify it among several filters.
55
56
    \param label A display label for the filter.
56
57
    \param multi_select If true, the filter permits more than option to be selected; otherwise, only a single
57
58
    option can be selected.
74
75
    bool multi_select() const;
75
76
 
76
77
    /**
77
 
    \brief Add a new option to this filter.
 
78
    \brief Add a new option to this filter. The option is 'off' by default.
 
79
 
 
80
    \throws unity::InvalidArgumentException on invalid id or label
78
81
    \return The new option instance.
79
82
    */
80
83
    FilterOption::SCPtr add_option(std::string const& id, std::string const& label);
93
96
    bool has_active_option(FilterState const& filter_state) const;
94
97
 
95
98
    /**
96
 
    \brief Get active options from an instance of FilterState for this filter.
97
 
    \return The set of selected filter options.
 
99
    \brief Get the active options from a FilterState instance for this filter.
 
100
 
 
101
    The returned set may be empty if the user de-selected all options. However, if there is no state
 
102
    recorded for this filter in the filter_state instance, then all the options enabled by default are returned.
 
103
 
 
104
    \return The set of selected filter options (or options enabled by default if the filter is not present in the filter_state).
98
105
    */
99
106
    std::set<FilterOption::SCPtr> active_options(FilterState const& filter_state) const;
100
107
 
114
121
    */
115
122
    static void update_state(FilterState& filter_state, std::string const& filter_id, std::string const& option_id, bool value);
116
123
 
 
124
    /**
 
125
    \brief Add a new option to this filter and provide its default value.
 
126
 
 
127
    \throws unity::LogicException if multiple options with value of 'true' are provided for a single-selection OptionSelectorFilter.
 
128
    \throws unity::InvalidArgumentException on invalid id or label
 
129
    \return The new option instance.
 
130
    */
 
131
    FilterOption::SCPtr add_option(std::string const& id, std::string const& label, bool value);
 
132
 
 
133
    /**
 
134
    \brief Creates an OpionSelectorFilter inside a FilterGroup.
 
135
    \param id A unique identifier for the filter that can be used to later identify it among several filters.
 
136
    \param label A display label for the filter.
 
137
    \param group A filter group this filter should be added to.
 
138
    \param multi_select If true, the filter permits more than option to be selected; otherwise, only a single
 
139
    option can be selected.
 
140
    \throws unity::InvalidArgumentException on invalid null group.
 
141
 
 
142
    \note The multi-selection cannot be combined with unity::scopes::FilterBase::DisplayHints::Primary flag set via
 
143
    unity::scopes::FilterBase::set_display_hints().
 
144
    */
 
145
    static OptionSelectorFilter::UPtr create(std::string const& id, std::string const& label, FilterGroup::SCPtr const& group, bool multi_select = false);
 
146
 
117
147
private:
118
148
    OptionSelectorFilter(internal::OptionSelectorFilterImpl*);
119
149
    internal::OptionSelectorFilterImpl* fwd() const;