WinStd Windows Win32 API using Standard C++

Loading...
Searching...
No Matches
WinHTTP.h
1/*
2 SPDX-License-Identifier: MIT
3 Copyright © 1991-2024 Amebis
4 Copyright © 2016 GÉANT
5*/
6
8
9#pragma once
10
11#include "Common.h"
12#include <winhttp.h>
13
14 namespace winstd
15{
18
24 class http : public handle<HINTERNET, NULL>
25 {
26 WINSTD_HANDLE_IMPL(http, HINTERNET, NULL)
27
28 public:
34 virtual ~http()
35 {
36 if (m_h != invalid)
37 free_internal();
38 }
39
40 protected:
46 void free_internal() noexcept override
47 {
48 WinHttpCloseHandle(m_h);
49 }
50 };
51
53}
winstd::handle
Base abstract template class to support generic object handle keeping.
Definition Common.h:1024
winstd::handle< HINTERNET, NULL >::m_h
handle_type m_h
Object handle.
Definition Common.h:1276
winstd::http
HTTP handle wrapper class.
Definition WinHTTP.h:25
winstd::http::~http
virtual ~http()
Closes a handle to the HTTP.
Definition WinHTTP.h:34
winstd::http::free_internal
void free_internal() noexcept override
Closes a handle to the HTTP.
Definition WinHTTP.h:46
winstd::ref_unique_ptr
Helper class for returning pointers to std::unique_ptr.
Definition Common.h:863
WINSTD_HANDLE_IMPL
#define WINSTD_HANDLE_IMPL(C, T, INVAL)
Implements default constructors and operators to prevent their auto-generation by compiler.
Definition Common.h:164
winstd::handle< HINTERNET, NULL >::invalid
static const HINTERNET invalid
Invalid handle value.
Definition Common.h:1034