29#define _Class _URLSessionDownloadTask
31#pragma mark - URLSessionTask
33#define CURL_WRITEFUNC_ABORT 0
42 const size_t bytesWritten = fwrite(
data, size, count, this->file);
43 this->urlSessionTask.bytesReceived += bytesWritten;
60 curl_easy_setopt(self->locals.
handle, CURLOPT_WRITEDATA, self);
63#pragma mark - Class lifecycle
83 .name =
"URLSessionDownloadTask",
87 .interfaceSize =
sizeof(URLSessionDownloadTaskInterface),
Class * _initialize(const ClassDef *def)
Initializes the given Class.
#define super(type, obj, method,...)
void * ident
The identity type, similar to Objective-C id.
static size_t writeFunction(char *data, size_t size, size_t count, ident self)
The CURLOPT_WRITEFUNCTION callback.
static void initialize(Class *clazz)
Use download tasks to save remote resources to file.
#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.
ident interface
The interface of the Class.
MutableData * data(void)
Returns a new MutableData.
Use download tasks to save remote resources to file.
Class * _URLSessionDownloadTask(void)
The URLSessionDownloadTask archetype.
URL session tasks are handles to pending URL operations.
ident handle
The backing libcurl handle.
void setup(URLSessionTask *)
Sets up this task.
Class * _URLSessionTask(void)
The URLSessionTask archetype.