unity.scopes.CannedQuery
Parameters of a search query. More...
#include <unity/scopes/CannedQuery.h>
Public Member Functions | |
| CannedQuery (std::string const &scope_id) | |
| Creates a query for given scope with empty query string. | |
| CannedQuery (std::string const &scope_id, std::string const &query_str, std::string const &department_id) | |
| Creates a query for given scope with specific query string and in given department. | |
| void | set_department_id (std::string const &dep_id) |
| Sets or updates the department. | |
| void | set_query_string (std::string const &query_str) |
| Sets or updates the query string. | |
| void | set_filter_state (FilterState const &filter_state) |
| Sets filter state. | |
| std::string | scope_id () const |
| Returns the scope identifier of this CannedQuery. More... | |
| std::string | department_id () const |
| Returns the department id of this CannedQuery. More... | |
| std::string | query_string () const |
| Returns the query string of this CannedQuery. More... | |
| std::string | to_uri () const |
| Returns a string representation of this CannedQuery object as a URI using scope:// schema. More... | |
| FilterState | filter_state () const |
| Get state of the filters for this CannedQuery. More... | |
| void | set_user_data (Variant const &value) |
| Attach arbitrary data. More... | |
| bool | has_user_data () const |
| Checks if user data has been attached to this query. More... | |
| Variant | user_data () const |
| Get user data attached to this query. More... | |
| Copy and assignment | |
Copy and assignment operators (move and non-move versions) have the usual value semantics. | |
| CannedQuery (CannedQuery const &other) | |
| CannedQuery (CannedQuery &&) | |
| CannedQuery & | operator= (CannedQuery const &other) |
| CannedQuery & | operator= (CannedQuery &&) |
Static Public Member Functions | |
| static CannedQuery | from_uri (std::string const &uri) |
| Recreates a CannedQuery object from a scope:// URI. More... | |
Detailed Description
Parameters of a search query.
Holds all parameters of a search query: the target scope id, query string, department id, and state of the filters. CannedQuery can also carry arbitrary data (set by calling CannedQuery::set_user_data(Variant const&)) which can then be retrieved back with CannedQuery::user_data() when CannedQuery object is received in ScopeBase::search. This arbitrary data can be used to store any state-related information that may be useful for the scope when new search request is performed.
Can be converted to/from scope:// uri schema string.
Member Function Documentation
| std::string unity::scopes::CannedQuery::department_id | ( | ) | const |
Returns the department id of this CannedQuery.
- Returns
- The department id.
| FilterState unity::scopes::CannedQuery::filter_state | ( | ) | const |
Get state of the filters for this CannedQuery.
Pass this state to methods of specific filter instances (such as unity::scopes::OptionSelectorFilter::active_options())to examine filter state.
- Returns
- The state of the filters.
|
static |
Recreates a CannedQuery object from a scope:// URI.
- Returns
- a CannedQuery instance
- Exceptions
-
InvalidArgumentException if the URI cannot be parsed.
| bool unity::scopes::CannedQuery::has_user_data | ( | ) | const |
Checks if user data has been attached to this query.
- Returns
- true if data is available.
| std::string unity::scopes::CannedQuery::query_string | ( | ) | const |
Returns the query string of this CannedQuery.
- Returns
- The query string.
| std::string unity::scopes::CannedQuery::scope_id | ( | ) | const |
Returns the scope identifier of this CannedQuery.
- Returns
- The scope identifier.
| void unity::scopes::CannedQuery::set_user_data | ( | Variant const & | value | ) |
Attach arbitrary data.
- Parameters
-
value Data to attach to this canned query
| std::string unity::scopes::CannedQuery::to_uri | ( | ) | const |
Returns a string representation of this CannedQuery object as a URI using scope:// schema.
- Returns
- The URI for the query.
| Variant unity::scopes::CannedQuery::user_data | ( | ) | const |
Get user data attached to this query.
- Returns
- Data variant
- Exceptions
-
unity::LogicException if user data is not available.