kcurl v0.1.10
Basic C++23 wrapper over libcurl
 
Loading...
Searching...
No Matches
curl.hpp
Go to the documentation of this file.
1#pragma once
2#include <cstdint>
3#include <format>
4
5namespace kcurl {
8class Curl {
9 public:
10 enum Feature : std::uint8_t {
11 None = 0,
12 TLS = 1 << 0,
13 IPv6 = 1 << 1,
14 Win32Unicode = 1 << 2,
15 UnixSockets = 1 << 3,
16 Http2 = 1 << 4,
17 Http3 = 1 << 5,
18 LargeFile = 1 << 6,
19 };
20
21 Curl(Curl const&) = delete;
22 Curl(Curl&&) = delete;
23 Curl& operator=(Curl const&) = delete;
24 Curl& operator=(Curl&&) = delete;
25
26 [[nodiscard]] static auto default_flags() -> long;
27
28 explicit Curl(long flags = default_flags());
30
31 [[nodiscard]] auto get_features() const -> Feature;
32};
33} // namespace kcurl
34
35template <>
36struct std::formatter<kcurl::Curl::Feature> {
37 template <class ParseContext>
38 constexpr auto parse(ParseContext& ctx) {
39 return ctx.begin();
40 }
41
42 static auto format(kcurl::Curl::Feature flags, format_context& fc) -> format_context::iterator;
43};
Top-level RAII wrapper for curl. Use if libcurl initialization/shutdown is not already handled.
Definition curl.hpp:8
Curl(long flags=default_flags())
static auto default_flags() -> long
Feature
Definition curl.hpp:10
@ TLS
Definition curl.hpp:12
@ UnixSockets
Definition curl.hpp:15
@ LargeFile
Definition curl.hpp:18
@ Win32Unicode
Definition curl.hpp:14
@ IPv6
Definition curl.hpp:13
@ None
Definition curl.hpp:11
@ Http2
Definition curl.hpp:16
@ Http3
Definition curl.hpp:17
Curl(Curl const &)=delete
Curl & operator=(Curl &&)=delete
auto get_features() const -> Feature
Curl & operator=(Curl const &)=delete
Curl(Curl &&)=delete
Definition byte_array.hpp:6
constexpr auto parse(ParseContext &ctx)
Definition curl.hpp:38
static auto format(kcurl::Curl::Feature flags, format_context &fc) -> format_context::iterator