Joedb 9.1.4
The Journal-Only Embedded Database
Loading...
Searching...
No Matches
CURL_File.h
Go to the documentation of this file.
1#ifndef joedb_CURL_File_declared
2#define joedb_CURL_File_declared
3
5
6#define CURL_NO_OLDIES
7#include <curl/curl.h>
8
9namespace joedb
10{
12 {
13 protected:
14 CURL * const curl;
15
16 public:
17 CURL_Easy();
18 CURL_Easy(const CURL_Easy &) = delete;
19 CURL_Easy &operator=(const CURL_Easy &) = delete;
20 ~CURL_Easy();
21 };
22
23 /// @ingroup journal
24 class CURL_File: public CURL_Easy, public Buffered_File
25 {
26 private:
27 static void error_check(CURLcode code);
28
29 struct pread_Callback_Data
30 {
31 char * const buffer;
32 const size_t size;
33 size_t offset;
34
35 size_t copy(char *contents, size_t real_size);
36 };
37
38 static size_t pread_callback
39 (
40 void *contents,
41 size_t size,
42 size_t nmemb,
43 void *p
44 );
45
46 static size_t copy_callback
47 (
48 void *contents,
49 size_t size,
50 size_t nmemb,
51 void *p
52 );
53
54 void perform_range(int64_t start, int64_t size) const;
55
56 size_t pread(char *buffer, size_t size, int64_t offset) const override;
57 void copy_to(Buffered_File &destination, int64_t start, int64_t size) override;
58
59 public:
60 CURL_File(const char *url, bool verbose);
61 };
62}
63
64#endif
CURL_Easy(const CURL_Easy &)=delete
CURL_Easy & operator=(const CURL_Easy &)=delete
CURL *const curl
Definition CURL_File.h:14
Definition Blob.h:7