2
* Copyright (C) 2013 Canonical Ltd
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.
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.
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/>.
16
* Authored by: Pawel Stolowski <pawel.stolowski@canonical.com>
19
#include <scopes/OptionSelectorFilter.h>
20
#include <scopes/internal/OptionSelectorFilterImpl.h>
31
OptionSelectorFilter::OptionSelectorFilter(std::string const& id, std::string const& label, bool multi_select)
32
: FilterBase(new internal::OptionSelectorFilterImpl(id, label, multi_select))
36
OptionSelectorFilter::OptionSelectorFilter(VariantMap const& var)
37
: FilterBase(new internal::OptionSelectorFilterImpl(var))
41
OptionSelectorFilter::SPtr OptionSelectorFilter::create(std::string const& id, std::string const& label, bool multi_select)
43
return std::shared_ptr<OptionSelectorFilter>(new OptionSelectorFilter(id, label, multi_select));
46
std::string OptionSelectorFilter::label() const
48
return fwd()->label();
51
bool OptionSelectorFilter::multi_select() const
53
return fwd()->multi_select();
56
FilterOption::SCPtr OptionSelectorFilter::add_option(std::string const& id, std::string const& label)
58
return fwd()->add_option(id, label);
61
std::list<FilterOption::SCPtr> OptionSelectorFilter::options() const
63
return fwd()->options();
66
std::set<FilterOption::SCPtr> OptionSelectorFilter::active_options(FilterState const& filter_state) const
68
return fwd()->active_options(filter_state);
71
void OptionSelectorFilter::update_state(FilterState& filter_state, FilterOption::SCPtr option, bool active) const
73
fwd()->update_state(filter_state, option, active);
76
void OptionSelectorFilter::update_state(FilterState& filter_state, std::string const& filter_id, std::string const& option_id, bool value)
78
internal::OptionSelectorFilterImpl::update_state(filter_state, filter_id, option_id, value);
81
internal::OptionSelectorFilterImpl* OptionSelectorFilter::fwd() const
83
return dynamic_cast<internal::OptionSelectorFilterImpl*>(p.get());