Unity Scopes API
|
A selection filter that displays a list of choices and allows one or more of them to be selected. More...
#include <unity/scopes/OptionSelectorFilter.h>
Public Member Functions | |
std::string | label () const |
Get the label of this filter. More... | |
bool | multi_select () const |
Check if this filter supports multiple options to be selected. More... | |
FilterOption::SCPtr | add_option (std::string const &id, std::string const &label) |
Add a new option to this filter. More... | |
std::list< FilterOption::SCPtr > | options () const |
Get all options of this filter, in the order they were added. More... | |
std::set< FilterOption::SCPtr > | active_options (FilterState const &filter_state) const |
Get active options from an instance of FilterState for this filter. More... | |
void | update_state (FilterState &filter_state, FilterOption::SCPtr option, bool active) const |
Marks given FilterOption of this filter instance as active (or not active) in a FilterState object. More... | |
![]() | |
std::string | id () const |
Get the identifier of this filter. More... | |
std::string | filter_type () const |
Get the type name of this filter. More... | |
Static Public Member Functions | |
static OptionSelectorFilter::SPtr | create (std::string const &id, std::string const &label, bool multi_select=false) |
Creates an OpionSelectorFilter. More... | |
static void | update_state (FilterState &filter_state, std::string const &filter_id, std::string const &option_id, bool value) |
Marks an option of a filter active/inactive in a FilterState object, without having an instance of OptionSelectorFilter. More... | |
A selection filter that displays a list of choices and allows one or more of them to be selected.
std::set< FilterOption::SCPtr > unity::scopes::OptionSelectorFilter::active_options | ( | FilterState const & | filter_state | ) | const |
Get active options from an instance of FilterState for this filter.
FilterOption::SCPtr unity::scopes::OptionSelectorFilter::add_option | ( | std::string const & | id, |
std::string const & | label | ||
) |
Add a new option to this filter.
|
static |
Creates an OpionSelectorFilter.
id | A unique identifier for the filter that can be used to identify it later among several filters. |
label | A display label for the filter. |
multi_select | If true, the filter permits more than option to be selected; otherwise, only a single option can be selected. |
std::string unity::scopes::OptionSelectorFilter::label | ( | ) | const |
Get the label of this filter.
bool unity::scopes::OptionSelectorFilter::multi_select | ( | ) | const |
Check if this filter supports multiple options to be selected.
std::list< FilterOption::SCPtr > unity::scopes::OptionSelectorFilter::options | ( | ) | const |
Get all options of this filter, in the order they were added.
void unity::scopes::OptionSelectorFilter::update_state | ( | FilterState & | filter_state, |
FilterOption::SCPtr | option, | ||
bool | active | ||
) | const |
Marks given FilterOption of this filter instance as active (or not active) in a FilterState object.
Records the given FilterOption as "selected" in the FilterState. This is meant to be used to modify a FilterState received with a search request before sending it back to the client (UI shell).
|
static |
Marks an option of a filter active/inactive in a FilterState object, without having an instance of OptionSelectorFilter.
Updates an instance of FilterState, without the need for an OptionSelectorFilter instance. This is meant to be used when creating a canned Query that references another scope.