AUI Framework  develop
Cross-platform base for C++ UI apps
Loading...
Searching...
No Matches
ACurl Class Reference

Easy curl instance. More...

#include <AUI/Curl/ACurl.h>

Detailed Description

ACurl::Builder is used to construct ACurl.

Analogous to Qt's QNetworkRequest.

Member Typedef Documentation

◆ ReadCallback

using ACurl::ReadCallback = std::function<std::size_t(char* dst, size_t maxLen)>
Parameters
dstdestination buffer you should write to.
maxLendestination buffer size aka max length.
Returns
bytes written to the destination buffer. Zero means data unavailability (but the stream may be continued in the future).

Unlike regular streams, blocking is not allowed. To indicate the data unavailability, return zero. To indicate end of file, throw an AEOFException.

◆ WriteCallback

using ACurl::WriteCallback = std::function<size_t(AByteBufferView data)>
Parameters
datareceived data
Returns
bytes written to the destination buffer. Zero means buffer does not have enough space to store supplied data (but the stream may be continued in the future), the supplied data is not discarded and being kept in the curl buffers.

Unlike regular streams, blocking is not allowed. To indicate buffer overflow, return zero. To indicate end of file, throw an AEOFException.

◆ WriteCallbackV2

using ACurl::WriteCallbackV2 = std::function<size_t(ACurl& curl, AByteBufferView data)>
Parameters
curlcurl instance
datareceived data
Returns
bytes written to the destination buffer. Zero means buffer does not have enough space to store supplied data (but the stream may be continued in the future), the supplied data is not discarded and being kept in the curl buffers.

Unlike regular streams, blocking is not allowed. To indicate buffer overflow, return zero. To indicate end of file, throw an AEOFException.

Member Function Documentation

> All members, including inherited

◆ close()

virtual void ACurl::close ( )
virtual

curl does not have a function which immediately stops the transfer (see https://curl.se/docs/faq.html#How_do_I_stop_an_ongoing_transfe). The stop functionality is handled in ACurl by returning error code on all callbacks. close() function is non-blocking, and some time would be taken until the run() method finally returns.

After calling close() method, none of the result signals (like fail, success) will be called.

close() is non-blocking function.

close() is thread-safe.

Reimplemented in AWebsocket.

Member Data Documentation

◆ fail

emits<ErrorDescription> ACurl::fail
Note
A protocol-level error (like HTTP(S) 404) is not treated as a fail. Check for response code via the getResponseCode() function.

◆ success

emits ACurl::success
Note
A protocol-level error (like HTTP(S) 404) is not treated as a fail. Check for response code via the getResponseCode() function.