Ditto 4.7.5-rc.1
Loading...
Searching...
No Matches
AttachmentFetcher.hpp
1#ifndef _DITTO_ATTACHMENT_FETCHER_
2#define _DITTO_ATTACHMENT_FETCHER_
3
4#include "AttachmentFetchEvent.hpp"
5#include "AttachmentToken.hpp"
6#include "Ditto.hpp"
7#include "Observer.hpp"
8
9#include <functional>
10#include <memory>
11
12namespace ditto {
13class DittoHandleWrapper;
14
20 std::function<void(std::unique_ptr<AttachmentFetchEvent>)> fn;
21};
22
27 : public Observer,
28 public std::enable_shared_from_this<AttachmentFetcher> {
29 friend class Collection;
30 friend class Store;
31
32public:
33 ~AttachmentFetcher(); // required by pimpl.
36
37 struct ArcCtx;
38
39private:
40 void on_stop() override;
41 void ffi_cancel();
42 // Non-trivial dtor requires manual swap for assignment operators.
43 static void swap(AttachmentFetcher &lhs, AttachmentFetcher &rhs) noexcept;
44
46 bool owned_by_store, std::shared_ptr<AttachmentToken> const &token,
47 AttachmentFetcherEventHandler &&on_fetch_event,
48 std::weak_ptr<Ditto::Fields> const &weak_ditto_fields,
49 std::shared_ptr<DittoHandleWrapper> const &ditto_handle_wrapper);
50
51 std::unique_ptr<ArcCtx> ctx; // pimpl.
52 std::weak_ptr<Ditto::Fields> weak_ditto_fields;
53};
54
55} // namespace ditto
56#endif
These objects are returned by calls to Store::fetch_attachment.
Definition AttachmentFetcher.hpp:28
A reference to a collection in a Store.
Definition Collection.hpp:27
An observation token returned by any observation API in the Ditto SDK. Retain this object to continue...
Definition Observer.hpp:11
Provides access to Collections and a write transaction API.
Definition Store.hpp:29
A thin wrapper around a function that will get called when there are updates relating to an attempt t...
Definition AttachmentFetcher.hpp:19