Handles asynchronous HTTP GET requests.
More...
#include <HttpFetcher.h>
|
| HttpFetcher (wxEvtHandler *handler, const wxString &url) |
| Constructor for HttpFetcher.
|
|
void | Fetch () |
| Initiates the asynchronous HTTP fetch operation.
|
|
void | Destroy () |
| Marks the instance for destruction.
|
|
|
void | FetchData () |
| Performs the actual HTTP GET request.
|
|
|
wxEvtHandler * | m_handler |
| Pointer to the event handler that receives the completion event.
|
|
wxString | m_url |
| URL to be fetched.
|
|
bool | dead = false |
| Flag indicating whether the instance should be deleted after execution.
|
|
Handles asynchronous HTTP GET requests.
HttpFetcher is responsible for fetching data from a given URL asynchronously using a separate thread. Once the request is completed, it sends an event back to the main thread.
◆ HttpFetcher()
HttpFetcher::HttpFetcher |
( |
wxEvtHandler * | handler, |
|
|
const wxString & | url ) |
Constructor for HttpFetcher.
- Parameters
-
handler | The wxEvtHandler that will receive the fetched data event. |
url | The URL to fetch data from. |
◆ Destroy()
void HttpFetcher::Destroy |
( |
| ) |
|
Marks the instance for destruction.
This method sets a flag indicating that the instance should be deleted once the fetch operation completes.
◆ Fetch()
void HttpFetcher::Fetch |
( |
| ) |
|
Initiates the asynchronous HTTP fetch operation.
This method spawns a separate thread to perform the HTTP request.
◆ FetchData()
void HttpFetcher::FetchData |
( |
| ) |
|
|
private |
Performs the actual HTTP GET request.
This method runs in a separate thread, fetches data synchronously using cpr, and then sends the result back to the main thread.
◆ dead
bool HttpFetcher::dead = false |
|
private |
Flag indicating whether the instance should be deleted after execution.
◆ m_handler
wxEvtHandler* HttpFetcher::m_handler |
|
private |
Pointer to the event handler that receives the completion event.
◆ m_url
wxString HttpFetcher::m_url |
|
private |
The documentation for this class was generated from the following file: