#include <assert.h>
#include <curl/curl.h>
#include "URLSessionDownloadTask.h"
Go to the source code of this file.
◆ _Class
◆ CURL_WRITEFUNC_ABORT
#define CURL_WRITEFUNC_ABORT 0 |
◆ _URLSessionDownloadTask()
Class * _URLSessionDownloadTask |
( |
void |
| ) |
|
Definition at line 77 of file URLSessionDownloadTask.c.
77 {
80
83 .name = "URLSessionDownloadTask",
87 .interfaceSize = sizeof(URLSessionDownloadTaskInterface),
89 });
90 });
91
92 return clazz;
93}
Class * _initialize(const ClassDef *def)
Initializes the given Class.
static void initialize(Class *clazz)
#define do_once(once, block)
Executes the given block at most one time.
ClassDefs are passed to _initialize via an archetype to initialize a Class.
The runtime representation of a Class.
Use download tasks to save remote resources to file.
Class * _URLSessionTask(void)
The URLSessionTask archetype.
◆ initialize()
static void initialize |
( |
Class * |
clazz | ) |
|
|
static |
- See also
- Class::initialize(Class *)
Definition at line 68 of file URLSessionDownloadTask.c.
68 {
69
71}
ident interface
The interface of the Class.
void setup(URLSessionTask *)
Sets up this task.
◆ setup()
- See also
- URLSessionTask::setup(URLSessionTask *)
Definition at line 51 of file URLSessionDownloadTask.c.
51 {
52
54
56
57 assert(this->file);
58
60 curl_easy_setopt(self->locals.
handle, CURLOPT_WRITEDATA, self);
61}
#define super(type, obj, method,...)
static size_t writeFunction(char *data, size_t size, size_t count, ident self)
The CURLOPT_WRITEFUNCTION callback.
URL session tasks are handles to pending URL operations.
ident handle
The backing libcurl handle.
◆ writeFunction()
static size_t writeFunction |
( |
char * |
data, |
|
|
size_t |
size, |
|
|
size_t |
count, |
|
|
ident |
self |
|
) |
| |
|
static |
The CURLOPT_WRITEFUNCTION
callback.
Definition at line 38 of file URLSessionDownloadTask.c.
38 {
39
41
42 const size_t bytesWritten = fwrite(
data, size, count, this->file);
43 this->urlSessionTask.bytesReceived += bytesWritten;
44
45 return bytesWritten;
46}
MutableData * data(void)
Returns a new MutableData.