Gin
Public Member Functions | Public Attributes | List of all members
AsyncDownload Class Reference

Async Download. More...

Inherits juce::Thread, and juce::AsyncUpdater.

Public Member Functions

 AsyncDownload (juce::String url_, std::function< void(AsyncDownload *, const juce::MemoryBlock &, bool)> cb_, int timeoutMS_=0)
 
 AsyncDownload (juce::URL url_, std::function< void(AsyncDownload *, const juce::MemoryBlock &, bool)> cb_, int timeoutMS_=0)
 
 ~AsyncDownload () override
 
void run () override
 
bool readEntireBinaryStream (juce::MemoryBlock &destData, bool usePostCommand=false)
 
void handleAsyncUpdate () override
 

Public Attributes

juce::URL url
 
std::function< void(AsyncDownload *, juce::MemoryBlock, bool)> cb
 
int timeoutMS = 0
 
bool ok = false
 
juce::MemoryBlock data
 

Detailed Description

Async Download.

Doesn't have the main thread pause the URL::downloadToFile has

Constructor & Destructor Documentation

◆ AsyncDownload() [1/2]

AsyncDownload::AsyncDownload ( juce::String  url_,
std::function< void(AsyncDownload *, const juce::MemoryBlock &, bool)>  cb_,
int  timeoutMS_ = 0 
)

◆ AsyncDownload() [2/2]

AsyncDownload::AsyncDownload ( juce::URL  url_,
std::function< void(AsyncDownload *, const juce::MemoryBlock &, bool)>  cb_,
int  timeoutMS_ = 0 
)

◆ ~AsyncDownload()

AsyncDownload::~AsyncDownload ( )
override

Member Function Documentation

◆ run()

void AsyncDownload::run ( )
override

References data, ok, and readEntireBinaryStream().

◆ readEntireBinaryStream()

bool AsyncDownload::readEntireBinaryStream ( juce::MemoryBlock &  destData,
bool  usePostCommand = false 
)

References timeoutMS, and url.

Referenced by run().

◆ handleAsyncUpdate()

void AsyncDownload::handleAsyncUpdate ( )
override

References cb, data, and ok.

Member Data Documentation

◆ url

juce::URL AsyncDownload::url

Referenced by readEntireBinaryStream().

◆ cb

std::function<void (AsyncDownload*, juce::MemoryBlock, bool)> AsyncDownload::cb

Referenced by handleAsyncUpdate().

◆ timeoutMS

int AsyncDownload::timeoutMS = 0

Referenced by readEntireBinaryStream().

◆ ok

bool AsyncDownload::ok = false

Referenced by handleAsyncUpdate(), and run().

◆ data

juce::MemoryBlock AsyncDownload::data

Referenced by handleAsyncUpdate(), and run().


The documentation for this class was generated from the following file: