CFNetwork: add cfhttpmessage
Signed-off-by: Simon Rozman <simon@rozman.si>
This commit is contained in:
parent
ead116d198
commit
9375e22ced
28
include/MacStd/CFNetwork.hpp
Normal file
28
include/MacStd/CFNetwork.hpp
Normal file
@ -0,0 +1,28 @@
|
||||
/*
|
||||
SPDX-License-Identifier: MIT
|
||||
Copyright © 2023-2025 Amebis
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "CoreFoundation.hpp"
|
||||
#include <CFNetwork/CFNetwork.h>
|
||||
#include <stdexcept>
|
||||
|
||||
namespace macstd {
|
||||
///
|
||||
/// HTTP message object traits
|
||||
///
|
||||
struct cfhttpmessage_traits : public cfobject_traits<CFHTTPMessageRef>
|
||||
{
|
||||
static CFHTTPMessageRef duplicate(CFHTTPMessageRef h)
|
||||
{
|
||||
CFHTTPMessageRef h2 = CFHTTPMessageCreateCopy(kCFAllocatorDefault, h);
|
||||
if (h2 == invalid)
|
||||
throw std::runtime_error("CFHTTPMessageCreateCopy failed");
|
||||
return h2;
|
||||
}
|
||||
};
|
||||
|
||||
using cfhttpmessage = handle<CFHTTPMessageRef, cfhttpmessage_traits>;
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user