SDK  2.1.4 [async]
CloudBackend Software Development Kit - SDK API for C++
QueryResult.h
1 /*
2  Copyright © CloudBackend AB 2020-2023.
3 */
4 
5 
6 #ifndef INCLUDE_CBE_QUERY_RESULT_H_
7 #define INCLUDE_CBE_QUERY_RESULT_H_
8 
9 #include "cbe/Types.h"
10 
11 #include <vector>
12 
13 namespace CBI {
14 class QueryResult;
15 using QueryResultPtr = std::shared_ptr<CBI::QueryResult>;
16 class ItemEventProtocol;
17 using ItemDelegatePtr = std::shared_ptr<ItemEventProtocol>;
18 class PublishEventProtocol;
19 using PublishDelegatePtr = std::shared_ptr<PublishEventProtocol>;
20 class ShareEventProtocol;
21 using ShareDelegatePtr = std::shared_ptr<ShareEventProtocol>;
22 class SubscribeEventProtocol;
23 using SubscribeDelegatePtr = std::shared_ptr<SubscribeEventProtocol>;
24 } // namespace CBI
25 
26 namespace cbe {
27 
28 class Filter;
29  namespace util {
30 class Context;
31  } // namespace util
32  namespace delegate {
33 class QueryDelegate;
34 using QueryDelegatePtr = std::shared_ptr<QueryDelegate>;
35 CBI::ItemDelegatePtr createCbiQueryDelegate(QueryDelegatePtr,
37 class QueryJoinDelegate;
38 using QueryJoinDelegatePtr = std::shared_ptr<QueryJoinDelegate>;
39 CBI::ItemDelegatePtr createCbiQueryDelegate(QueryJoinDelegatePtr,
41 class JoinDelegate;
42 using JoinDelegatePtr = std::shared_ptr<JoinDelegate>;
43 CBI::ItemDelegatePtr createCbiJoinDelegate(JoinDelegatePtr,
45  } // namespace delegate
46 
51 class QueryResult {
52 public:
56  Filter filter() const;
57 
61  using ItemsSnapshot = std::vector<Item>;
72 
76  std::uint64_t itemsLoaded() const;
77 
82  std::uint64_t totalCount() const;
83 
87  std::uint64_t objectsLoaded() const;
88 
92  std::uint64_t containersLoaded() const;
93 
99  bool containsItem(ItemId itemId) const;
100 
101  friend std::ostream& operator<<(std::ostream& os,
102  const QueryResult& queryResult);
103 
113  ~QueryResult();
114 
127  explicit operator bool() const;
128 private:
129  struct Impl;
130  std::shared_ptr<Impl> pImpl{};
131 
132  friend class CloudBackend;
133  friend class Container;
134  friend class QueryChain;
135  friend class QueryChainSync;
136  friend class ShareManager;
137  friend class SubscribeManager;
138  friend CBI::ItemDelegatePtr delegate::createCbiQueryDelegate(
141  friend CBI::ItemDelegatePtr delegate::createCbiQueryDelegate(
144  friend CBI::ItemDelegatePtr delegate::createCbiJoinDelegate(
147  QueryResult(CBI::QueryResultPtr cbiPeerPtr);
148  CBI::QueryResult& getCbiPeer() const;
149 }; // class QueryResult
150 
151 }
152 // namespace cbe
153 
154 #endif // INCLUDE_CBE_DIRECTORY_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
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::uint64_t itemsLoaded() const
std::uint64_t containersLoaded() const
std::uint64_t totalCount() const
bool containsItem(ItemId itemId) const
Filter filter() const
ItemsSnapshot getItemsSnapshot() const
Returns a copy of a vector containing the items for this QueryResult.
std::uint64_t objectsLoaded() const
QueryResult(cbe::DefaultCtor)
Default constructor.
std::vector< Item > ItemsSnapshot
A vector of items to hold a snapshot.
Definition: QueryResult.h:61
Managing Shares.
Definition: ShareManager.h:27
For managing subscriptions.
Definition: SubscribeManager.h:30
std::shared_ptr< ShareDelegate > ShareDelegatePtr
Definition: ShareDelegate.h:70
std::shared_ptr< SubscribeDelegate > SubscribeDelegatePtr
Definition: SubscribeDelegate.h:60
std::shared_ptr< PublishDelegate > PublishDelegatePtr
Definition: PublishDelegate.h:66
std::shared_ptr< JoinDelegate > JoinDelegatePtr
Definition: JoinDelegate.h:67
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
std::uint64_t ItemId
Id of a cbe::Container or cbe::Object.
Definition: Types.h:88
DefaultCtor
Default constructor marker.
Definition: Types.h:204
Definition: Context.h:11