C++  1.4.6
CloudBackend Software Development Kit - SDK API for C++
CloudBackend.h
1 /*
2  Copyright © CloudBackend AB 2020 - 2022..
3 */
4 
5 #ifndef INCLUDE_CBE_CLOUDBACKEND_H_
6 #define INCLUDE_CBE_CLOUDBACKEND_H_
7 
8 #include <string>
9 #include <map>
10 #include <iostream>
11 
12 #include "CBE/Account.h"
13 #include "CBE/Item.h"
14 #include "CBE/Types.h"
15 #include "CBE/Filter.h"
16 #include "CBE/Object.h"
17 
18 #include "CBE/ShareManager.h"
19 #include "CBE/GroupManager.h"
20 
21 namespace CBE
22 {
24 class Container;
25 
27 {
28 public:
36  static CloudBackendPtr logIn(const std::string &username, const std::string &password, const std::string &source, CBE::AccountDelegatePtr delegate);
37 
39 
52  static CloudBackendPtr createAccount(const std::string& username, const std::string& password,
53  const std::string& email, const std::string& firstName,
54  const std::string& lastName, const std::string& source,
55  CBE::AccountDelegatePtr delegate);
56 
63  void addListener(CBE::ItemDelegatePtr delegate);
64 
71  void removeListener(CBE::ItemDelegatePtr delegate);
72 
73 
82  virtual QueryChainPtr query(uint64_t containerId, CBE::ItemDelegatePtr delegate);
83 
94  virtual QueryChainPtr query(CBE::container_id_t containerId, CBE::Filter filter, CBE::ItemDelegatePtr delegate); // add a Container Id
95 
107  virtual CBE::QueryChainPtr queryWithPath(std::string relativePath, CBE::ItemDelegatePtr delegate, CBE::container_id_t queryRoot = 0);
108 
121  virtual QueryResultPtr search(std::string tags, CBE::container_id_t containerId, CBE::ItemDelegatePtr delegate);
122 
136  virtual CBE::QueryResultPtr search(CBE::Filter filter, CBE::container_id_t containerId, CBE::ItemDelegatePtr delegate);
137 
142  static CBE::ContainerPtr castContainer(CBE::ItemPtr item);
143 
148  static CBE::ObjectPtr castObject(CBE::ItemPtr item);
149 
155  virtual bool clearCache();
156 
162  CBE::AccountPtr account();
163 
169  std::string version();
170 
176  CBE::GroupManager* groupManager(); // Group - NYI
177 
183  CBE::ShareManager* shareManager(); // Shares
184 
185  virtual ~CloudBackend();
186 
187 protected:
188  CloudBackend();
189  CloudBackend(const CloudBackend&) = delete;
190  CloudBackend& operator=(const CloudBackend&) = delete;
191 
192  CBE::ShareManager* _shareManager;
193  CBE::GroupManager* _groupManager;
194  CBE::AccountPtr _account;
195 
196 
197  bool listening;
198 
199  std::vector<CBE::ItemDelegatePtr> _event_listeners;
200 };
201 
202 } // namespace CBE
203 // namespace CBE
204 
205 #endif // INCLUDE_CBE_CLOUDBACKEND_H_
CBE::CloudBackend::queryWithPath
virtual CBE::QueryChainPtr queryWithPath(std::string relativePath, CBE::ItemDelegatePtr delegate, CBE::container_id_t queryRoot=0)
CBE::CloudBackend::shareManager
CBE::ShareManager * shareManager()
See the ShareManager description.
CBE::CloudBackend::account
CBE::AccountPtr account()
Returns an account object with information on the user.
CBE::GroupManager
Definition: GroupManager.h:15
CBE::CloudBackend
Definition: CloudBackend.h:26
CBE::CloudBackend::version
std::string version()
Returns the version number of the SDK.
CBE::CloudBackend::groupManager
CBE::GroupManager * groupManager()
See the GroupManager description.
CBE::CloudBackend::removeListener
void removeListener(CBE::ItemDelegatePtr delegate)
CBE::CloudBackend::createAccount
static CloudBackendPtr createAccount(const std::string &username, const std::string &password, const std::string &email, const std::string &firstName, const std::string &lastName, const std::string &source, CBE::AccountDelegatePtr delegate)
CBE::CloudBackend::search
virtual QueryResultPtr search(std::string tags, CBE::container_id_t containerId, CBE::ItemDelegatePtr delegate)
CBE::CloudBackend::query
virtual QueryChainPtr query(uint64_t containerId, CBE::ItemDelegatePtr delegate)
CBE::Filter
Definition: Filter.h:28
CBE::CloudBackend::addListener
void addListener(CBE::ItemDelegatePtr delegate)
CBE::CloudBackend::logIn
static CloudBackendPtr logIn(const std::string &username, const std::string &password, const std::string &source, CBE::AccountDelegatePtr delegate)
CBE::ShareManager
Definition: ShareManager.h:14
CBE::CloudBackend::castContainer
static CBE::ContainerPtr castContainer(CBE::ItemPtr item)
CBE::CloudBackend::castObject
static CBE::ObjectPtr castObject(CBE::ItemPtr item)
CBE::CloudBackend::clearCache
virtual bool clearCache()
Can be called to clear the cache of the SDK, if you are having memory issues.