An abstraction to Lib Curl functions. More...
#include <CurlWrapper.h>
Public Member Functions | |
CurlWrapper () | |
virtual void | customRequest (const te::core::URI &uri, const std::string &request, const std::string &body=std::string(""), const ::std::string &header=std::string("")) |
Method to make a custom request, useful for performing a HTTP DELETE request. More... | |
virtual void | downloadFile (const std::string &url, const std::string &filePath, te::common::TaskProgress *taskProgress=0) |
Method to download a file retrieved from given URL and save into the specified file path. More... | |
virtual void | downloadFile (const std::string &url, std::FILE *file, te::common::TaskProgress *taskProgress=0) |
Method to download a file retrieved from given URL and save into the specified File. More... | |
virtual void | get (const te::core::URI &uri, std::string &buffer) |
Method to make a GET request. More... | |
virtual AuthenticationMethod | getAuthenticationMethod () const |
Gets current AuthenticationMethod. More... | |
virtual std::string | getTaskMessage () const |
This method gets the message that will be used on Progress Bar when this object is downloading some file. More... | |
virtual std::string | getUsername () const |
Gets the user name that will be used when an athentication method is set. More... | |
virtual void | post (const te::core::URI &uri, const std::string &postFields, const ::std::string &header) |
Method to request a post in a determined URI. More... | |
virtual void | putFile (const te::core::URI &uri, const std::string &filePath, const ::std::string &header) |
Method to request a put with a file in a determined URI. More... | |
virtual void | putFile (const te::core::URI &uri, const std::fstream &file, const ::std::string &header) |
Method to request a put a file in a determined URI. More... | |
virtual const std::string & | response () const |
Returns the last operation response if the protocol allows it. More... | |
virtual const long | responseCode () const |
Returns the last operation response code. More... | |
virtual void | setAuthenticationMethod (const AuthenticationMethod &method) |
Sets the authentication method that will be used on the requests. More... | |
virtual void | setPassword (const std::string &password) |
Sets the password that will be used when an athentication method is set. More... | |
virtual void | setTaskMessage (const std::string &taskMessage) |
This method sets the message that will be used on Progress Bar when this object is downloading some file. More... | |
virtual void | setUsername (const std::string &username) |
Sets the user name that will be used when an athentication method is set. More... | |
virtual | ~CurlWrapper () |
Protected Member Functions | |
virtual void | addAuthParameters () |
Adds HTTP Authentication parameters according to the current AuthenticationMethod. More... | |
virtual void | clean () |
Reset the curl handle and the class members. More... | |
Private Attributes | |
std::unique_ptr< Impl > | m_pimpl |
An abstraction to Lib Curl functions.
Definition at line 59 of file CurlWrapper.h.
te::ws::core::CurlWrapper::CurlWrapper | ( | ) |
|
virtual |
|
protectedvirtual |
Adds HTTP Authentication parameters according to the current AuthenticationMethod.
|
protectedvirtual |
Reset the curl handle and the class members.
|
virtual |
Method to make a custom request, useful for performing a HTTP DELETE request.
uri | The URI with the address information |
request | The custom request |
|
virtual |
Method to download a file retrieved from given URL and save into the specified file path.
url | URL that the file will be downloaded. |
filePath | file path where downloaded file will be saved. |
|
virtual |
Method to download a file retrieved from given URL and save into the specified File.
url | URL that the file will be downloaded. |
file | File where downloaded file will be write. |
|
virtual |
Method to make a GET request.
uri | The URI with the address information |
buffer | Where the server answer will be write. |
|
virtual |
Gets current AuthenticationMethod.
|
virtual |
This method gets the message that will be used on Progress Bar when this object is downloading some file.
|
virtual |
Gets the user name that will be used when an athentication method is set.
|
virtual |
Method to request a post in a determined URI.
uri | The URI with the address information to post |
postFields | The parameters and values to post |
header | A header to the post request |
|
virtual |
Method to request a put with a file in a determined URI.
uri | The URI with the address information |
file | Path The full path of the file to put |
header | A header to the put request |
|
virtual |
Method to request a put a file in a determined URI.
uri | The URI with the address information |
file | Contains the file opened by the fstream |
header | A header to the put request |
|
virtual |
Returns the last operation response if the protocol allows it.
|
virtual |
Returns the last operation response code.
|
virtual |
Sets the authentication method that will be used on the requests.
method | (e. g.: Basic or Digest) |
|
virtual |
Sets the password that will be used when an athentication method is set.
password |
|
virtual |
This method sets the message that will be used on Progress Bar when this object is downloading some file.
taskMessage | new message. |
|
virtual |
Sets the user name that will be used when an athentication method is set.
username |
|
private |
Definition at line 196 of file CurlWrapper.h.