libnick 2024.12.0
A cross-platform base for native Nickvision applications.
Loading...
Searching...
No Matches
Nickvision::Network::CurlEasy Class Reference

An object for making easy curl requests. More...

#include <curleasy.h>

Public Member Functions

 CurlEasy (const std::string &url="")
 Constructs a CurlEasy.
 
 ~CurlEasy ()
 Destructs a CurlEasy.
 
const std::string & getUrl () const
 Gets the url to make requests to.
 
void setUrl (const std::string &url)
 Sets the url to make requests to.
 
bool getNoBody () const
 Gets whether or not to include the body in the response.
 
void setNoBody (bool noBody)
 Sets whether or not to include the body in the response.
 
const std::vector< std::string > & getHeaders () const
 Gets the headers to include in the request.
 
bool setHeaders (const std::vector< std::string > &headers)
 Sets the headers to include in the request.
 
const std::string & getUserAgent () const
 Gets the user agent to use in the request.
 
void setUserAgent (const std::string &userAgent)
 Sets the user agent to use in the request.
 
std::basic_ostream< char > * getStream () const
 Gets the stream to write the response to.
 
void setStream (std::basic_ostream< char > *stream)
 Sets the stream to write the response to.
 
const CurlProgressFunctiongetProgressFunction () const
 Gets the progress function to use during the request.
 
void setProgressFunction (const CurlProgressFunction &progress)
 Sets the progress function to use during the request.
 
bool reset (const std::string &url="")
 Resets the curl request.
 
CURLcode perform ()
 Performs the curl request.
 

Detailed Description

An object for making easy curl requests.

Constructor & Destructor Documentation

◆ CurlEasy()

Nickvision::Network::CurlEasy::CurlEasy ( const std::string & url = "")

Constructs a CurlEasy.

Parameters
urlThe url to make requests to
Exceptions
std::runtime_errorIf curl fails to initialize

◆ ~CurlEasy()

Nickvision::Network::CurlEasy::~CurlEasy ( )

Destructs a CurlEasy.

Member Function Documentation

◆ getHeaders()

const std::vector< std::string > & Nickvision::Network::CurlEasy::getHeaders ( ) const

Gets the headers to include in the request.

Returns
The headers to include

◆ getNoBody()

bool Nickvision::Network::CurlEasy::getNoBody ( ) const

Gets whether or not to include the body in the response.

Returns
True to exclude the body, else false

◆ getProgressFunction()

const CurlProgressFunction & Nickvision::Network::CurlEasy::getProgressFunction ( ) const

Gets the progress function to use during the request.

Returns
The progress function to use

◆ getStream()

std::basic_ostream< char > * Nickvision::Network::CurlEasy::getStream ( ) const

Gets the stream to write the response to.

Returns
The stream to write the response to

◆ getUrl()

const std::string & Nickvision::Network::CurlEasy::getUrl ( ) const

Gets the url to make requests to.

Returns
The url to make requests to

◆ getUserAgent()

const std::string & Nickvision::Network::CurlEasy::getUserAgent ( ) const

Gets the user agent to use in the request.

Returns
The user agent to use

◆ perform()

CURLcode Nickvision::Network::CurlEasy::perform ( )

Performs the curl request.

Returns
The code returned by the curl request

◆ reset()

bool Nickvision::Network::CurlEasy::reset ( const std::string & url = "")

Resets the curl request.

Parameters
urlThe url to make requests to
Returns
True if successful, else false

◆ setHeaders()

bool Nickvision::Network::CurlEasy::setHeaders ( const std::vector< std::string > & headers)

Sets the headers to include in the request.

Parameters
headersThe headers to include
Returns
True if successful, else false

◆ setNoBody()

void Nickvision::Network::CurlEasy::setNoBody ( bool noBody)

Sets whether or not to include the body in the response.

Parameters
noBodyTrue to exclude the body, else false

◆ setProgressFunction()

void Nickvision::Network::CurlEasy::setProgressFunction ( const CurlProgressFunction & progress)

Sets the progress function to use during the request.

Parameters
progressThe progress function to use

◆ setStream()

void Nickvision::Network::CurlEasy::setStream ( std::basic_ostream< char > * stream)

Sets the stream to write the response to.

Parameters
streamThe stream to write the response to

◆ setUrl()

void Nickvision::Network::CurlEasy::setUrl ( const std::string & url)

Sets the url to make requests to.

Parameters
urlThe url to make requests to

◆ setUserAgent()

void Nickvision::Network::CurlEasy::setUserAgent ( const std::string & userAgent)

Sets the user agent to use in the request.

Parameters
userAgentThe user agent to use

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