Unity Scopes API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
unity::scopes::RangeInputFilter Class Reference

A range filter which allows a start and end value to be entered by user, and any of them is optional. More...

#include <unity/scopes/RangeInputFilter.h>

Inheritance diagram for unity::scopes::RangeInputFilter:

Public Member Functions

std::string start_label () const
 Get the label of start value. More...
 
std::string end_label () const
 Get the label of end value. More...
 
std::string unit_label () const
 Get the label of unit for this filter.. More...
 
bool has_start_value (FilterState const &filter_state) const
 Check if filter state holds a start value for this filter instance. More...
 
bool has_end_value (FilterState const &filter_state) const
 Check if filter state holds an end value for this filter instance. More...
 
double start_value (FilterState const &filter_state) const
 Get start value for this filter instance. More...
 
double end_value (FilterState const &filter_state) const
 Get end value for this filter instance. More...
 
void update_state (FilterState &filter_state, Variant const &start_value, Variant const &end_value) const
 Store start and end value for this filter in the filter state. More...
 
- Public Member Functions inherited from unity::scopes::FilterBase
void set_display_hints (int hints)
 Sets display hints for the Shell UI. More...
 
int display_hints () const
 Get display hints of this filter. 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 RangeInputFilter::SPtr create (std::string const &id, std::string const &start_label, std::string const &end_label, std::string const &unit_label="")
 Creates a RangeInputFilter. More...
 
static void update_state (FilterState &filter_state, std::string const &filter_id, Variant const &start_value, Variant const &end_value)
 Store start and end value in the filter state, without having an instance of RangeInputFilter. More...
 

Additional Inherited Members

- Public Types inherited from unity::scopes::FilterBase
enum  DisplayHints { Default = 0, Primary = 1 }
 Display hints for the Shell UI. More...
 

Detailed Description

A range filter which allows a start and end value to be entered by user, and any of them is optional.

Member Function Documentation

RangeInputFilter::SPtr unity::scopes::RangeInputFilter::create ( std::string const &  id,
std::string const &  start_label,
std::string const &  end_label,
std::string const &  unit_label = "" 
)
static

Creates a RangeInputFilter.

Parameters
idA unique identifier for the filter that can be used to identify it later among several filters.
start_labelA display label for the input box of start value (can be empty).
end_labelA display label for the input box of end value (can be empty).
unit_labelA display label for the unit of this range filter (e.g. currency name).
Returns
Instance of RangeInputFilter.
std::string unity::scopes::RangeInputFilter::end_label ( ) const

Get the label of end value.

Returns
The label of end value.
double unity::scopes::RangeInputFilter::end_value ( FilterState const &  filter_state) const

Get end value for this filter instance.

Returns
end value
Exceptions
unity::LogicExceptionif end value is not set
bool unity::scopes::RangeInputFilter::has_end_value ( FilterState const &  filter_state) const

Check if filter state holds an end value for this filter instance.

Parameters
filter_stateThe state of filters.
Returns
true if filter_state has an end value for this filter.
bool unity::scopes::RangeInputFilter::has_start_value ( FilterState const &  filter_state) const

Check if filter state holds a start value for this filter instance.

Parameters
filter_stateThe state of filters.
Returns
true if filter_state has a start value for this filter.
std::string unity::scopes::RangeInputFilter::start_label ( ) const

Get the label of start value.

Returns
The label of start value.
double unity::scopes::RangeInputFilter::start_value ( FilterState const &  filter_state) const

Get start value for this filter instance.

Returns
start value
Exceptions
unity::LogicExceptionif start value is not set
std::string unity::scopes::RangeInputFilter::unit_label ( ) const

Get the label of unit for this filter..

Returns
The label of unit.
void unity::scopes::RangeInputFilter::update_state ( FilterState filter_state,
Variant const &  start_value,
Variant const &  end_value 
) const

Store start and end value for this filter in the filter state.

Updates filter_state with start and end values for this filter instance. Allowed data types for start_value and end_value are Variant::Type::Null, Variant::Type::Double and Variant::Type::Int. Integer values will get converted to double when returned via unity::scopes::RangeInputFilter::start_value() and unity::scopes::RangeInputFilter::end_value() methods. Pass Variant::null() as start_value or end_value if that value is unspecified (hasn't been entered or got erased by the user from the input box).

Parameters
filter_stateFilterState instance to update
start_valueStart value
end_valueEnd value
void unity::scopes::RangeInputFilter::update_state ( FilterState filter_state,
std::string const &  filter_id,
Variant const &  start_value,
Variant const &  end_value 
)
static

Store start and end value in the filter state, without having an instance of RangeInputFilter.

Updates filter_state with start and end values without an instance of RangeInputFilter. This is meant for the explanation of this method. to be used when creating a CannedQuery that points to a foreign scope.

See the documentation of unity::scopes::update_state(FilterState const& filter_state, Variant const& start_value, Variant const& end_value)

Parameters
filter_stateFilterState instance to update
filter_idUnique identifier of filter
start_valueStart value
end_valueEnd value

The documentation for this class was generated from the following files: