SDK  2.1.4 [async]
CloudBackend Software Development Kit - SDK API for C++
Filter.h
1 /*
2  Copyright © CloudBackend AB 2020 - 2023.
3 */
4 
5 #ifndef CBE__Filter_h__
6 #define CBE__Filter_h__
7 
8 #include "cbe/Types.h"
9 
10 #include <iosfwd>
11 #include <memory>
12 
13 namespace CBI {
14 class Filter;
15 class ItemEventProtocol;
16 using ItemDelegatePtr = std::shared_ptr<ItemEventProtocol>;
17 } // namespace CBI
18 
19 namespace cbe {
20  namespace util {
21 class Context;
22  } // namespace util
23  namespace delegate {
24 class QueryDelegate;
25 using QueryDelegatePtr = std::shared_ptr<QueryDelegate>;
26 CBI::ItemDelegatePtr createCbiQueryDelegate(QueryDelegatePtr,
28 class QueryJoinDelegate;
29 using QueryJoinDelegatePtr = std::shared_ptr<QueryJoinDelegate>;
30 CBI::ItemDelegatePtr createCbiQueryDelegate(QueryJoinDelegatePtr,
32  } // namespace delegate
33 
40 class Filter {
41 public:
42  Filter();
43  Filter(const Filter& rh);
44  Filter(Filter&& rh);
45  Filter& operator=(const Filter& rh);
46  Filter& operator=(Filter&& rh);
47  ~Filter();
48 
61 
73  std::string getQuery() const;
74 
78  bool getAscending() const;
79 
83  bool getDeleted() const;
84 
88  bool getContainerFirst() const;
89 
93  bool isJoinedResult() const;
94 
102  std::uint32_t getOffset() const;
103 
107  std::uint32_t getCount() const;
108 
112  bool getByPassCache() const;
113 
121 
127 
134 
158  cbe::Filter& setQuery(std::string query);
159 
166  cbe::Filter& setAscending(bool ascending);
167 
174  cbe::Filter& setDeleted(bool deleted);
175 
182  cbe::Filter& setContainerFirst(bool containerFirst);
183 
195  cbe::Filter& setOffset(std::uint32_t offset);
196 
206  cbe::Filter& setCount(std::uint32_t count);
207 
216 
225  cbe::Filter& setByPassCache(bool byPassCache);
226 
227  friend std::ostream& operator<<(std::ostream& os, const Filter& filter);
228 private:
229  struct Impl;
230  std::unique_ptr<Impl> pImpl;
231  friend class CloudBackend;
232  friend class Container;
233  friend class QueryChain;
234  friend class QueryResult;
235  friend CBI::ItemDelegatePtr delegate::createCbiQueryDelegate(
238  friend CBI::ItemDelegatePtr delegate::createCbiQueryDelegate(
241  Filter(CBI::Filter&& cbiPeer);
242  CBI::Filter& getCbiPeer() const;
243 }; // class Filter
244 
245 } // namespace cbe
246 
247 
248 #endif // #ifndef CBE__Filter_h__
The session that holds the connection with the cloud.
Definition: CloudBackend.h:47
A collection of Item, can also represent a table or folder.
Definition: Container.h:63
Use to select Item that meets specific criterias when doing a query.
Definition: Filter.h:40
std::uint32_t getCount() const
Returns the size of the resultset of the query.
cbe::FilterOrder getItemOrder() const
Returns the order the query was sorted.
cbe::Filter & setAscending(bool ascending)
Sets the order, ascending , in which data should be displayed.
bool getByPassCache() const
Returns if skipping the cache was used or not.
cbe::Filter & setOffset(std::uint32_t offset)
Set the offset for paging.
bool isJoinedResult() const
Determines if the resultset comes from a joined query.
cbe::Filter & setByPassCache(bool byPassCache)
Set to ignore the local SDK cache.
cbe::Filter & setQuery(std::string query)
Set the query string.
cbe::Filter & setItemOrder(cbe::FilterOrder order)
Set the order of how data will be shown by the enum of FilterOrder.
bool getAscending() const
Returns the settings on how the data was sorted and displayed.
std::uint32_t getOffset() const
Determines the offset of items to be skiped.
cbe::Filter & setDeleted(bool deleted)
Whether to include deleted items.
bool getContainerFirst() const
Determines if containers should be sorted before objects.
bool getDeleted() const
Determines if deleted objects in the bin are included.
std::string getQuery() const
Returns the query string that was set on the filter.
cbe::Filter & setContainerFirst(bool containerFirst)
If Container should be displayed before Object.
cbe::ItemType getDataType() const
Returns the requested data type.
cbe::Filter & setDataType(cbe::ItemType itemType)
Set which datatypes to query for.
cbe::Filter & setCount(std::uint32_t count)
Set the maximum resultset.
cbe::Container container()
Returns the parent container that was queried, if it is in the cache. This is after a query was done,...
To do a search for Object combining more than one Container table.
Definition: QueryChain.h:32
resultset of data retrieved.
Definition: QueryResult.h:51
std::shared_ptr< QueryJoinDelegate > QueryJoinDelegatePtr
Definition: QueryJoinDelegate.h:76
std::shared_ptr< QueryDelegate > QueryDelegatePtr
Definition: QueryDelegate.h:100
Root namespace for the CloudBackend SDK API.
Definition: Account.h:22
FilterOrder
Definition: Types.h:221
ItemType
Definition: Types.h:242
Definition: Context.h:11