remwharead/src/curl_wrapper/README.adoc

66 lines
1.8 KiB
Plaintext

= curl_wrapper
:project: curl_wrapper
:uri-base: https://schlomp.space/tastytea/{project}
:uri-cmake: https://cmake.org/
:uri-libcurl: https://curl.haxx.se/libcurl/
:uri-catch: https://github.com/catchorg/Catch2
:uri-doxygen: http://www.doxygen.nl/
Light libcurl wrapper for when you need to GET a website with minimum effort.
This is _not_ supposed to be a package on its own, but a thing you drop into
your project.
I made this because the curl wrapper I used before is no longer maintained and
the other wrappers are either incomplete or unmaintained as well. _I do not
guarantee anything, use at your own risk._
URL: <{uri-base}>.
== Example program
[source,cpp]
--------------------------------------------------------------------------------
#include "curl_wrapper.hpp"
#include <iostream>
namespace cw = curl_wrapper;
int main()
{
cw::CURLWrapper curl;
const auto answer{curl.make_http_request(cw::http_method::GET,
"http://example.com/")};
if (answer)
{
std::cout << answer;
}
}
--------------------------------------------------------------------------------
== Use with CMake
Drop this project into a subfolder in your project tree. It will be compiled as
a static library.
[source,cmake]
--------------------------------------------------------------------------------
add_subdirectory(curl_wrapper)
add_executable(test)
target_link_libraries(test PRIVATE curl_wrapper)
--------------------------------------------------------------------------------
.CMake options:
* `-DWITH_CURL_WRAPPER_TESTS=YES` Compiles the tests.
* `-DWITH_CURL_WRAPPER_DOC=YES` Generate API reference.
== Dependencies
* C++17
* link:{uri-cmake}[CMake] >= 3.9
* link:{uri-libcurl}[libcurl] >= 7.52
* Optional:
** Tests: link:{uri-catch}[Catch] >= 1.2
** Documentation: link:{uri-doxygen}[Doxygen] >= 1.8