Stroika Library 3.0d16
 
Loading...
Searching...
No Matches
Connection_libcurl.h
1/*
2 * Copyright(c) Sophist Solutions, Inc. 1990-2025. All rights reserved
3 */
4#ifndef _Stroika_Foundation_IO_Network_Transfer_Connection_libcurl_h_
5#define _Stroika_Foundation_IO_Network_Transfer_Connection_libcurl_h_ 1
6
7#include "Stroika/Foundation/StroikaPreComp.h"
8
9#include <system_error>
10
11#if qStroika_HasComponent_libcurl
12// For CURLCode define
13#include <curl/curl.h>
14#endif
15
16#include "Stroika/Foundation/Execution/Exceptions.h"
17#include "Stroika/Foundation/IO/Network/Transfer/Connection.h"
18
19/*
20 * TODO:
21 * @todo Consider if curl global init/global_free stuff safe (look at curl code). May run into issue if other
22 * libraries using curl (like CurlNetAccessor::initCurl in xerces) do the same thing.
23 */
24
25#if qStroika_HasComponent_libcurl
26namespace Stroika::Foundation::IO::Network::Transfer::LibCurl {
27
28 /**
29 * Return a reference the the LibCurl error category object. This object lives forever (like other error categories).
30 */
31 const std::error_category& error_category () noexcept;
32
33 /**
34 * throw Exception () type iff the status indicates a real exception code. This MAY not throw an exception of type LibCurlException,
35 * but MAY map to any other exception type
36 */
37 void ThrowIfError (CURLcode status);
38
39 namespace Connection {
40
42
43 /**
44 * Create a 'libcurl' connection object (url specified in the options).
45 */
46 Ptr New (const Options& options = {});
47 }
48
49}
50#endif
51
52/*
53 ********************************************************************************
54 ***************************** Implementation Details ***************************
55 ********************************************************************************
56 */
57#include "Connection_libcurl.inl"
58
59#endif /*_Stroika_Foundation_IO_Network_Transfer_Connection_libcurl_h_*/