This documentation is automatically generated from the openFrameworks source code using doxygen and refers to the most recent release, version 0.12.0.
loads a file from a URL using an HTTP request More...
#include <ofURLFileLoader.h>
Public Member Functions | |
ofURLFileLoader () | |
ofHttpResponse | get (const std::string &url) |
make an HTTP request blocks until a response is returned or the request times out | |
int | getAsync (const std::string &url, const std::string &name="") |
make an asynchronous HTTP request will not block, placed in a queue and run using a background thread | |
ofHttpResponse | saveTo (const std::string &url, const of::filesystem::path &path) |
make an HTTP request and save the response data to a file blocks until a response is returned or the request times out | |
int | saveAsync (const std::string &url, const of::filesystem::path &path) |
make an asynchronous HTTP request and save the response data to a file will not block, placed in a queue and run using a background thread | |
void | remove (int id) |
remove an active HTTP request from the queue | |
void | clear () |
clear all active HTTP requests from the queue | |
void | stop () |
stop & remove all active and waiting HTTP requests | |
ofHttpResponse | handleRequest (const ofHttpRequest &request) |
int | handleRequestAsync (const ofHttpRequest &request) |
Detailed Description
loads a file from a URL using an HTTP request
Constructor & Destructor Documentation
◆ ofURLFileLoader()
ofURLFileLoader::ofURLFileLoader | ( | ) |
Member Function Documentation
◆ clear()
void ofURLFileLoader::clear | ( | ) |
clear all active HTTP requests from the queue
◆ get()
ofHttpResponse ofURLFileLoader::get | ( | const std::string & | url | ) |
make an HTTP request blocks until a response is returned or the request times out
- Parameters
-
url HTTP url to request, ie. "http://somewebsite.com/someapi/someimage.jpg"
- Returns
- HTTP response on success or failure
◆ getAsync()
int ofURLFileLoader::getAsync | ( | const std::string & | url, |
const std::string & | name = "" |
||
) |
make an asynchronous HTTP request will not block, placed in a queue and run using a background thread
- Parameters
-
url HTTP url to request, ie. "http://somewebsite.com/someapi/someimage.jpg" name optional key to use when sorting requests
- Returns
- unique id for the active HTTP request
◆ handleRequest()
ofHttpResponse ofURLFileLoader::handleRequest | ( | const ofHttpRequest & | request | ) |
blocks until a response is returned or the request times out
- Returns
- HTTP response on success or failure
◆ handleRequestAsync()
int ofURLFileLoader::handleRequestAsync | ( | const ofHttpRequest & | request | ) |
this is a non-blocking version of handleRequest that will return a response in the urlResponse callback
- Returns
- unique id of the active HTTP request
◆ remove()
void ofURLFileLoader::remove | ( | int | id | ) |
remove an active HTTP request from the queue
- Parameters
-
id HTTP request id
◆ saveAsync()
int ofURLFileLoader::saveAsync | ( | const std::string & | url, |
const of::filesystem::path & | path | ||
) |
make an asynchronous HTTP request and save the response data to a file will not block, placed in a queue and run using a background thread
- Parameters
-
url HTTP url to request, ie. "http://somewebsite.com/someapi/someimage.jpg" path file path to save to
- Returns
- unique id for the active HTTP request
◆ saveTo()
ofHttpResponse ofURLFileLoader::saveTo | ( | const std::string & | url, |
const of::filesystem::path & | path | ||
) |
make an HTTP request and save the response data to a file blocks until a response is returned or the request times out
- Parameters
-
url HTTP url to request, ie. "http://somewebsite.com/someapi/someimage.jpg" path file path to save to
- Returns
- HTTP response on success or failure
◆ stop()
void ofURLFileLoader::stop | ( | ) |
stop & remove all active and waiting HTTP requests
The documentation for this class was generated from the following files:
- /Users/icq4ever/Desktop/oF0120/libs/openFrameworks/utils/ofURLFileLoader.h
- /Users/icq4ever/Desktop/oF0120/libs/openFrameworks/utils/ofURLFileLoader.cpp