mastorss/src/curl_wrapper
tastytea 4de5c4e685
Merge commit '75633bdb459338ea4669233f627c416ae4eed656' into main
2020-11-21 22:15:32 +01:00
..
cmake Merge commit '1d4139cf0ebe2274d4cd2e58c913f91c02e80c8f' as 'src/curl_wrapper' 2020-11-21 21:44:17 +01:00
src Merge commit '75633bdb459338ea4669233f627c416ae4eed656' into main 2020-11-21 22:15:32 +01:00
tests Merge commit '1d4139cf0ebe2274d4cd2e58c913f91c02e80c8f' as 'src/curl_wrapper' 2020-11-21 21:44:17 +01:00
.clang-format Merge commit '1d4139cf0ebe2274d4cd2e58c913f91c02e80c8f' as 'src/curl_wrapper' 2020-11-21 21:44:17 +01:00
.drone.yml Merge commit '1d4139cf0ebe2274d4cd2e58c913f91c02e80c8f' as 'src/curl_wrapper' 2020-11-21 21:44:17 +01:00
.editorconfig Merge commit '1d4139cf0ebe2274d4cd2e58c913f91c02e80c8f' as 'src/curl_wrapper' 2020-11-21 21:44:17 +01:00
.gitignore Merge commit '1d4139cf0ebe2274d4cd2e58c913f91c02e80c8f' as 'src/curl_wrapper' 2020-11-21 21:44:17 +01:00
CMakeLists.txt Merge commit '75633bdb459338ea4669233f627c416ae4eed656' into main 2020-11-21 22:15:32 +01:00
LICENSE Merge commit '1d4139cf0ebe2274d4cd2e58c913f91c02e80c8f' as 'src/curl_wrapper' 2020-11-21 21:44:17 +01:00
README.adoc Merge commit '1d4139cf0ebe2274d4cd2e58c913f91c02e80c8f' as 'src/curl_wrapper' 2020-11-21 21:44:17 +01:00

README.adoc

curl_wrapper

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.

Example program

#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.

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.

Add with git subtree

Replace src/curl_wrapper with the path you want it to be in. Consult git-subtree(1) for more information.

git remote add curl_wrapper https://schlomp.space/tastytea/curl_wrapper.git
git subtree add --prefix=src/curl_wrapper curl_wrapper main --squash

Update subtree

git subtree pull --prefix=src/curl_wrapper curl_wrapper main --squash

Dependencies