SDK  2.1.4 [async]
CloudBackend Software Development Kit - SDK API for C++
cbe::Filter Class Reference

Use to select Item that meets specific criterias when doing a query. More...

#include <Filter.h>

Public Member Functions

 Filter (const Filter &rh)
 
 Filter (Filter &&rh)
 
Filteroperator= (const Filter &rh)
 
Filteroperator= (Filter &&rh)
 
cbe::ItemType getDataType () const
 Returns the requested data type. More...
 
std::string getQuery () const
 Returns the query string that was set on the filter. More...
 
bool getAscending () const
 Returns the settings on how the data was sorted and displayed.
 
bool getDeleted () const
 Determines if deleted objects in the bin are included.
 
bool getContainerFirst () const
 Determines if containers should be sorted before objects.
 
bool isJoinedResult () const
 Determines if the resultset comes from a joined query.
 
std::uint32_t getOffset () const
 Determines the offset of items to be skiped. More...
 
std::uint32_t getCount () const
 Returns the size of the resultset of the query.
 
bool getByPassCache () const
 Returns if skipping the cache was used or not.
 
cbe::FilterOrder getItemOrder () const
 Returns the order the query was sorted. More...
 
cbe::Container container ()
 Returns the parent container that was queried, if it is in the cache. This is after a query was done, not before.
 
cbe::FiltersetDataType (cbe::ItemType itemType)
 Set which datatypes to query for. More...
 
cbe::FiltersetQuery (std::string query)
 Set the query string. More...
 
cbe::FiltersetAscending (bool ascending)
 Sets the order, ascending , in which data should be displayed. More...
 
cbe::FiltersetDeleted (bool deleted)
 Whether to include deleted items. More...
 
cbe::FiltersetContainerFirst (bool containerFirst)
 If Container should be displayed before Object. More...
 
cbe::FiltersetOffset (std::uint32_t offset)
 Set the offset for paging. More...
 
cbe::FiltersetCount (std::uint32_t count)
 Set the maximum resultset. More...
 
cbe::FiltersetItemOrder (cbe::FilterOrder order)
 Set the order of how data will be shown by the enum of FilterOrder. More...
 
cbe::FiltersetByPassCache (bool byPassCache)
 Set to ignore the local SDK cache. More...
 

Friends

class CloudBackend
 
class Container
 
class QueryChain
 
class QueryResult
 
std::ostream & operator<< (std::ostream &os, const Filter &filter)
 
CBI::ItemDelegatePtr delegate::createCbiQueryDelegate (delegate::QueryDelegatePtr, cbe::util::Context &&)
 
CBI::ItemDelegatePtr delegate::createCbiQueryDelegate (delegate::QueryJoinDelegatePtr, cbe::util::Context &&)
 

Detailed Description

Use to select Item that meets specific criterias when doing a query.

Filtering on metadata KeyValues can be done with setQuery() and only to query for Object, not Container.

Member Function Documentation

◆ getDataType()

cbe::ItemType cbe::Filter::getDataType ( ) const

Returns the requested data type.

Such as ItemType e.g.,

  • cbe::ItemType::Container
  • cbe::ItemType::Object
  • cbe::ItemType::Group

◆ getItemOrder()

cbe::FilterOrder cbe::Filter::getItemOrder ( ) const

Returns the order the query was sorted.

Check enum FilterOrder to see options for sorting.

◆ getOffset()

std::uint32_t cbe::Filter::getOffset ( ) const

Determines the offset of items to be skiped.

Returns the offset of items in the beginning of total resultset to be skiped, that was used for the filter in the query.

◆ getQuery()

std::string cbe::Filter::getQuery ( ) const

Returns the query string that was set on the filter.

Query string e.g.,

  • name:Abc*
  • age:100
  • price<200
  • size>40

◆ setAscending()

cbe::Filter& cbe::Filter::setAscending ( bool  ascending)

Sets the order, ascending , in which data should be displayed.

Parameters
ascendingtrue = sorted in increasing order
false = sorted in decreasing order

◆ setByPassCache()

cbe::Filter& cbe::Filter::setByPassCache ( bool  byPassCache)

Set to ignore the local SDK cache.

Instead allways fetch the resultset from the cloud.

Parameters
byPassCachetrue = skip the SDK cache and ask the cloud.
default is to use the cache when available.

◆ setContainerFirst()

cbe::Filter& cbe::Filter::setContainerFirst ( bool  containerFirst)

If Container should be displayed before Object.

Parameters
containerFirsttrue = sort containers at the top of the resultset.
default is to not sort for this.

◆ setCount()

cbe::Filter& cbe::Filter::setCount ( std::uint32_t  count)

Set the maximum resultset.

Set the maximum number of items you want to get from a container.
E.g.: a container has 50 items but you only want the 10 first in ascending order then set ascending to true and setCount to 10.

Parameters
countmaximum number of items to return

◆ setDataType()

cbe::Filter& cbe::Filter::setDataType ( cbe::ItemType  itemType)

Set which datatypes to query for.

Parameters
itemTypeas defined in Types.h

◆ setDeleted()

cbe::Filter& cbe::Filter::setDeleted ( bool  deleted)

Whether to include deleted items.

Parameters
deletedtrue = include items in the bin
default is false

◆ setItemOrder()

cbe::Filter& cbe::Filter::setItemOrder ( cbe::FilterOrder  order)

Set the order of how data will be shown by the enum of FilterOrder.

E.g.: Title first, Relevance, published e.t.c.

Parameters
ordersee the enum FilterOrder in Types.h

◆ setOffset()

cbe::Filter& cbe::Filter::setOffset ( std::uint32_t  offset)

Set the offset for paging.

Offset is the item offset where to start your resultset.
E.g.: There is already a query resultset of the first 100 items and to get the rest you put setOffset() to 100 to get the next resultset from 101-.

Parameters
offsetfirst item start number of the complete resultset to return

◆ setQuery()

cbe::Filter& cbe::Filter::setQuery ( std::string  query)

Set the query string.

E.g., firstname:* (would search for all objects with the metadata key labeled firstname ).

Search string e.g.,

  • name:Abc*
  • age:100
  • price<200
  • size>40
Note
If used with rootContainer id as the dataId to search in, the whole account will be searched.
Parameters
queryis a string of key tags or key:value pairs.
E.g. Name:*|Country:Sweden|Country:Norway
This will search for objects with key Name but any value and where key Country is either Sweden or Norway.

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