ReleaseButler 1.0
😙 package manager on GitHub 😙
Loading...
Searching...
No Matches
cppcurl::CPPCURL Class Reference

A simple wrapper for libcurl. More...

#include <cppcurl.h>

Public Member Functions

 CPPCURL ()
 
 ~CPPCURL ()
 
 CPPCURL (CURL *curl)
 
 CPPCURL (const CPPCURL &val)
 
 CPPCURL (CPPCURL &&val) noexcept
 
auto operator= (const CPPCURL &val) -> CPPCURL &
 
auto operator= (CPPCURL &&val) noexcept -> CPPCURL &
 
auto ck4ok () const -> bool
 Detecting errors in the code_ field.
 
auto empty () const -> bool
 Return (curl_ == nullptr)
 
auto reset () -> void
 Simple wrapping of curl_easy_reset()
 
auto getinfo (CURLINFO flag, int64_t *val) -> void
 Simple encapsulation of curl_easy_getinfo().
 
auto getinfo_from_str (CURLINFO flag, std::string &val) -> void
 Simple encapsulation of curl_easy_getinfo().
 
auto setopt (CURLoption option, std::string_view val) -> void
 Simple encapsulation of curl_easy_setopt().
 
auto store_ass2file (std::string_view url, std::string_view file_name, bool vmod) -> bool
 Access the specified URL and save it to the specified file.
 
auto perform () -> void
 Simple wrapping of curl_easy_perform()
 
auto errorMsg () -> std::string_view
 Simple wrapping of curl_easy_strerror()
 

Detailed Description

A simple wrapper for libcurl.

This class contains only two private members, CURL *curl_ and CURLcode code_, and a simple wrapper for some libcurl functions, which I want to be able to use in other source files in a C++ way for web downloads and such.

Constructor & Destructor Documentation

◆ CPPCURL() [1/4]

cppcurl::CPPCURL::CPPCURL ( )

◆ ~CPPCURL()

cppcurl::CPPCURL::~CPPCURL ( )

◆ CPPCURL() [2/4]

cppcurl::CPPCURL::CPPCURL ( CURL * curl)
explicit

◆ CPPCURL() [3/4]

cppcurl::CPPCURL::CPPCURL ( const CPPCURL & val)

◆ CPPCURL() [4/4]

cppcurl::CPPCURL::CPPCURL ( CPPCURL && val)
noexcept

Member Function Documentation

◆ ck4ok()

auto cppcurl::CPPCURL::ck4ok ( ) const -> bool
nodiscard

Detecting errors in the code_ field.

◆ empty()

auto cppcurl::CPPCURL::empty ( ) const -> bool
nodiscard

Return (curl_ == nullptr)

◆ errorMsg()

auto cppcurl::CPPCURL::errorMsg ( ) -> std::string_view

Simple wrapping of curl_easy_strerror()

Returns
error message

◆ getinfo()

auto cppcurl::CPPCURL::getinfo ( CURLINFO flag,
int64_t * val ) -> void

Simple encapsulation of curl_easy_getinfo().

Call curl_easy_getinfo() to get the information and put the return value of curl_easy_getinfo() into the code_ member.

Parameters
`flag`Setting the type of information to be extracted.
`val`The int that needs to hold the information
Note
For more information on flag, see https://curl.se/libcurl/c/curl_easy_getinfo.html.

◆ getinfo_from_str()

auto cppcurl::CPPCURL::getinfo_from_str ( CURLINFO flag,
std::string & val ) -> void

Simple encapsulation of curl_easy_getinfo().

Call curl_easy_getinfo() to get the information and put the return value of curl_easy_getinfo() into the code_ member.

Parameters
`flag`Setting the type of information to be extracted.
`val`The std::string that needs to hold the information
Note
For more information on flag, see https://curl.se/libcurl/c/curl_easy_getinfo.html.

◆ operator=() [1/2]

auto cppcurl::CPPCURL::operator= ( const CPPCURL & val) -> CPPCURL&

◆ operator=() [2/2]

auto cppcurl::CPPCURL::operator= ( CPPCURL && val) -> CPPCURL&
noexcept

◆ perform()

auto cppcurl::CPPCURL::perform ( ) -> void

Simple wrapping of curl_easy_perform()

◆ reset()

auto cppcurl::CPPCURL::reset ( ) -> void

Simple wrapping of curl_easy_reset()

◆ setopt()

auto cppcurl::CPPCURL::setopt ( CURLoption option,
std::string_view val ) -> void

Simple encapsulation of curl_easy_setopt().

Call curl_easy_setopt() to set the information.

Parameters
`option`What information to set
`val`std::string holding information
Note
For more information on flag, see https://curl.se/libcurl/c/curl_easy_setopt.html.

◆ store_ass2file()

auto cppcurl::CPPCURL::store_ass2file ( std::string_view url,
std::string_view file_name,
bool vmod ) -> bool
nodiscard

Access the specified URL and save it to the specified file.

Parameters
`url`Specified url
`file_name`Specified file name
`vmode`Whether to output more information (for debugging purposes)
Returns
Returns a bool indicating whether the function was executed correctly.

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