use core::cell::UnsafeCell;
use core::ffi::*;
use core::marker::{PhantomData, PhantomPinned};
use core::ptr::NonNull;
#[cfg(feature = "objc2")]
use objc2::__framework_prelude::*;
use objc2_core_foundation::*;
use crate::*;
#[doc(alias = "WSProtocolHandlerRef")]
#[repr(C)]
pub struct WSProtocolHandler {
inner: [u8; 0],
_p: UnsafeCell<PhantomData<(*const UnsafeCell<()>, PhantomPinned)>>,
}
cf_type!(
unsafe impl WSProtocolHandler {}
);
#[cfg(feature = "objc2")]
cf_objc2_type!(
unsafe impl RefEncode<"OpaqueWSProtocolHandlerRef"> for WSProtocolHandler {}
);
unsafe impl ConcreteType for WSProtocolHandler {
#[doc(alias = "WSProtocolHandlerGetTypeID")]
#[inline]
fn type_id() -> CFTypeID {
extern "C-unwind" {
fn WSProtocolHandlerGetTypeID() -> CFTypeID;
}
unsafe { WSProtocolHandlerGetTypeID() }
}
}
impl WSProtocolHandler {
#[doc(alias = "WSProtocolHandlerCreate")]
#[deprecated = "No longer supported"]
#[inline]
pub unsafe fn new(
allocator: Option<&CFAllocator>,
protocol: Option<&CFString>,
) -> Option<CFRetained<WSProtocolHandler>> {
extern "C-unwind" {
fn WSProtocolHandlerCreate(
allocator: Option<&CFAllocator>,
protocol: Option<&CFString>,
) -> Option<NonNull<WSProtocolHandler>>;
}
let ret = unsafe { WSProtocolHandlerCreate(allocator, protocol) };
ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
}
#[doc(alias = "WSProtocolHandlerCopyRequestDictionary")]
#[deprecated = "No longer supported"]
#[inline]
pub unsafe fn request_dictionary(
&self,
data: Option<&CFData>,
) -> Option<CFRetained<CFDictionary>> {
extern "C-unwind" {
fn WSProtocolHandlerCopyRequestDictionary(
r#ref: &WSProtocolHandler,
data: Option<&CFData>,
) -> Option<NonNull<CFDictionary>>;
}
let ret = unsafe { WSProtocolHandlerCopyRequestDictionary(self, data) };
ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
}
#[doc(alias = "WSProtocolHandlerCopyReplyDictionary")]
#[deprecated = "No longer supported"]
#[inline]
pub unsafe fn reply_dictionary(
&self,
method_name: Option<&CFString>,
data: Option<&CFData>,
) -> Option<CFRetained<CFDictionary>> {
extern "C-unwind" {
fn WSProtocolHandlerCopyReplyDictionary(
r#ref: &WSProtocolHandler,
method_name: Option<&CFString>,
data: Option<&CFData>,
) -> Option<NonNull<CFDictionary>>;
}
let ret = unsafe { WSProtocolHandlerCopyReplyDictionary(self, method_name, data) };
ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
}
#[doc(alias = "WSProtocolHandlerCopyReplyDocument")]
#[deprecated = "No longer supported"]
#[inline]
pub unsafe fn reply_document(
&self,
method_context: Option<&CFDictionary>,
result_value: Option<&CFType>,
) -> Option<CFRetained<CFData>> {
extern "C-unwind" {
fn WSProtocolHandlerCopyReplyDocument(
r#ref: &WSProtocolHandler,
method_context: Option<&CFDictionary>,
result_value: Option<&CFType>,
) -> Option<NonNull<CFData>>;
}
let ret = unsafe { WSProtocolHandlerCopyReplyDocument(self, method_context, result_value) };
ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
}
#[doc(alias = "WSProtocolHandlerCopyFaultDocument")]
#[deprecated = "No longer supported"]
#[inline]
pub unsafe fn fault_document(
&self,
method_context: Option<&CFDictionary>,
fault_dict: Option<&CFDictionary>,
) -> Option<CFRetained<CFData>> {
extern "C-unwind" {
fn WSProtocolHandlerCopyFaultDocument(
r#ref: &WSProtocolHandler,
method_context: Option<&CFDictionary>,
fault_dict: Option<&CFDictionary>,
) -> Option<NonNull<CFData>>;
}
let ret = unsafe { WSProtocolHandlerCopyFaultDocument(self, method_context, fault_dict) };
ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
}
#[doc(alias = "WSProtocolHandlerCopyRequestDocument")]
#[deprecated = "No longer supported"]
#[inline]
pub unsafe fn request_document(
&self,
method_name: Option<&CFString>,
method_params: Option<&CFDictionary>,
method_param_order: Option<&CFArray>,
method_extras: Option<&CFDictionary>,
) -> Option<CFRetained<CFData>> {
extern "C-unwind" {
fn WSProtocolHandlerCopyRequestDocument(
r#ref: &WSProtocolHandler,
method_name: Option<&CFString>,
method_params: Option<&CFDictionary>,
method_param_order: Option<&CFArray>,
method_extras: Option<&CFDictionary>,
) -> Option<NonNull<CFData>>;
}
let ret = unsafe {
WSProtocolHandlerCopyRequestDocument(
self,
method_name,
method_params,
method_param_order,
method_extras,
)
};
ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
}
#[doc(alias = "WSProtocolHandlerCopyProperty")]
#[deprecated = "No longer supported"]
#[inline]
pub unsafe fn property(&self, property_name: Option<&CFString>) -> Option<CFRetained<CFType>> {
extern "C-unwind" {
fn WSProtocolHandlerCopyProperty(
r#ref: &WSProtocolHandler,
property_name: Option<&CFString>,
) -> Option<NonNull<CFType>>;
}
let ret = unsafe { WSProtocolHandlerCopyProperty(self, property_name) };
ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
}
#[doc(alias = "WSProtocolHandlerSetProperty")]
#[deprecated = "No longer supported"]
#[inline]
pub unsafe fn set_property(
&self,
property_name: Option<&CFString>,
property_value: Option<&CFType>,
) {
extern "C-unwind" {
fn WSProtocolHandlerSetProperty(
r#ref: &WSProtocolHandler,
property_name: Option<&CFString>,
property_value: Option<&CFType>,
);
}
unsafe { WSProtocolHandlerSetProperty(self, property_name, property_value) }
}
}
pub type WSProtocolHandlerSerializationProcPtr = Option<
unsafe extern "C-unwind" fn(
*mut WSProtocolHandler,
*const CFType,
*mut c_void,
) -> *const CFString,
>;
impl WSProtocolHandler {
#[doc(alias = "WSProtocolHandlerSetSerializationOverride")]
#[cfg(feature = "WSTypes")]
#[deprecated = "No longer supported"]
#[inline]
pub unsafe fn set_serialization_override(
&self,
obj_type: CFTypeID,
serialization_proc: WSProtocolHandlerSerializationProcPtr,
context: *mut WSClientContext,
) {
extern "C-unwind" {
fn WSProtocolHandlerSetSerializationOverride(
protocol: &WSProtocolHandler,
obj_type: CFTypeID,
serialization_proc: WSProtocolHandlerSerializationProcPtr,
context: *mut WSClientContext,
);
}
unsafe {
WSProtocolHandlerSetSerializationOverride(self, obj_type, serialization_proc, context)
}
}
}
pub type WSProtocolHandlerDeserializationProcPtr = Option<
unsafe extern "C-unwind" fn(
*mut WSProtocolHandler,
*mut CFXMLTree,
*mut CFXMLTree,
*mut c_void,
) -> *const CFType,
>;
impl WSProtocolHandler {
#[doc(alias = "WSProtocolHandlerSetDeserializationOverride")]
#[cfg(feature = "WSTypes")]
#[deprecated = "No longer supported"]
#[inline]
pub unsafe fn set_deserialization_override(
&self,
type_namespace: Option<&CFString>,
type_name: Option<&CFString>,
deserialization_proc: WSProtocolHandlerDeserializationProcPtr,
context: *mut WSClientContext,
) {
extern "C-unwind" {
fn WSProtocolHandlerSetDeserializationOverride(
protocol: &WSProtocolHandler,
type_namespace: Option<&CFString>,
type_name: Option<&CFString>,
deserialization_proc: WSProtocolHandlerDeserializationProcPtr,
context: *mut WSClientContext,
);
}
unsafe {
WSProtocolHandlerSetDeserializationOverride(
self,
type_namespace,
type_name,
deserialization_proc,
context,
)
}
}
}
#[deprecated = "renamed to `WSProtocolHandler::new`"]
#[inline]
pub unsafe extern "C-unwind" fn WSProtocolHandlerCreate(
allocator: Option<&CFAllocator>,
protocol: Option<&CFString>,
) -> Option<CFRetained<WSProtocolHandler>> {
extern "C-unwind" {
fn WSProtocolHandlerCreate(
allocator: Option<&CFAllocator>,
protocol: Option<&CFString>,
) -> Option<NonNull<WSProtocolHandler>>;
}
let ret = unsafe { WSProtocolHandlerCreate(allocator, protocol) };
ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
}
#[deprecated = "renamed to `WSProtocolHandler::request_dictionary`"]
#[inline]
pub unsafe extern "C-unwind" fn WSProtocolHandlerCopyRequestDictionary(
r#ref: &WSProtocolHandler,
data: Option<&CFData>,
) -> Option<CFRetained<CFDictionary>> {
extern "C-unwind" {
fn WSProtocolHandlerCopyRequestDictionary(
r#ref: &WSProtocolHandler,
data: Option<&CFData>,
) -> Option<NonNull<CFDictionary>>;
}
let ret = unsafe { WSProtocolHandlerCopyRequestDictionary(r#ref, data) };
ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
}
#[deprecated = "renamed to `WSProtocolHandler::reply_dictionary`"]
#[inline]
pub unsafe extern "C-unwind" fn WSProtocolHandlerCopyReplyDictionary(
r#ref: &WSProtocolHandler,
method_name: Option<&CFString>,
data: Option<&CFData>,
) -> Option<CFRetained<CFDictionary>> {
extern "C-unwind" {
fn WSProtocolHandlerCopyReplyDictionary(
r#ref: &WSProtocolHandler,
method_name: Option<&CFString>,
data: Option<&CFData>,
) -> Option<NonNull<CFDictionary>>;
}
let ret = unsafe { WSProtocolHandlerCopyReplyDictionary(r#ref, method_name, data) };
ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
}
#[deprecated = "renamed to `WSProtocolHandler::reply_document`"]
#[inline]
pub unsafe extern "C-unwind" fn WSProtocolHandlerCopyReplyDocument(
r#ref: &WSProtocolHandler,
method_context: Option<&CFDictionary>,
result_value: Option<&CFType>,
) -> Option<CFRetained<CFData>> {
extern "C-unwind" {
fn WSProtocolHandlerCopyReplyDocument(
r#ref: &WSProtocolHandler,
method_context: Option<&CFDictionary>,
result_value: Option<&CFType>,
) -> Option<NonNull<CFData>>;
}
let ret = unsafe { WSProtocolHandlerCopyReplyDocument(r#ref, method_context, result_value) };
ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
}
#[deprecated = "renamed to `WSProtocolHandler::fault_document`"]
#[inline]
pub unsafe extern "C-unwind" fn WSProtocolHandlerCopyFaultDocument(
r#ref: &WSProtocolHandler,
method_context: Option<&CFDictionary>,
fault_dict: Option<&CFDictionary>,
) -> Option<CFRetained<CFData>> {
extern "C-unwind" {
fn WSProtocolHandlerCopyFaultDocument(
r#ref: &WSProtocolHandler,
method_context: Option<&CFDictionary>,
fault_dict: Option<&CFDictionary>,
) -> Option<NonNull<CFData>>;
}
let ret = unsafe { WSProtocolHandlerCopyFaultDocument(r#ref, method_context, fault_dict) };
ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
}
#[deprecated = "renamed to `WSProtocolHandler::request_document`"]
#[inline]
pub unsafe extern "C-unwind" fn WSProtocolHandlerCopyRequestDocument(
r#ref: &WSProtocolHandler,
method_name: Option<&CFString>,
method_params: Option<&CFDictionary>,
method_param_order: Option<&CFArray>,
method_extras: Option<&CFDictionary>,
) -> Option<CFRetained<CFData>> {
extern "C-unwind" {
fn WSProtocolHandlerCopyRequestDocument(
r#ref: &WSProtocolHandler,
method_name: Option<&CFString>,
method_params: Option<&CFDictionary>,
method_param_order: Option<&CFArray>,
method_extras: Option<&CFDictionary>,
) -> Option<NonNull<CFData>>;
}
let ret = unsafe {
WSProtocolHandlerCopyRequestDocument(
r#ref,
method_name,
method_params,
method_param_order,
method_extras,
)
};
ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
}
#[deprecated = "renamed to `WSProtocolHandler::property`"]
#[inline]
pub unsafe extern "C-unwind" fn WSProtocolHandlerCopyProperty(
r#ref: &WSProtocolHandler,
property_name: Option<&CFString>,
) -> Option<CFRetained<CFType>> {
extern "C-unwind" {
fn WSProtocolHandlerCopyProperty(
r#ref: &WSProtocolHandler,
property_name: Option<&CFString>,
) -> Option<NonNull<CFType>>;
}
let ret = unsafe { WSProtocolHandlerCopyProperty(r#ref, property_name) };
ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
}
extern "C-unwind" {
#[deprecated = "renamed to `WSProtocolHandler::set_property`"]
pub fn WSProtocolHandlerSetProperty(
r#ref: &WSProtocolHandler,
property_name: Option<&CFString>,
property_value: Option<&CFType>,
);
}
extern "C-unwind" {
#[cfg(feature = "WSTypes")]
#[deprecated = "renamed to `WSProtocolHandler::set_serialization_override`"]
pub fn WSProtocolHandlerSetSerializationOverride(
protocol: &WSProtocolHandler,
obj_type: CFTypeID,
serialization_proc: WSProtocolHandlerSerializationProcPtr,
context: *mut WSClientContext,
);
}
extern "C-unwind" {
#[cfg(feature = "WSTypes")]
#[deprecated = "renamed to `WSProtocolHandler::set_deserialization_override`"]
pub fn WSProtocolHandlerSetDeserializationOverride(
protocol: &WSProtocolHandler,
type_namespace: Option<&CFString>,
type_name: Option<&CFString>,
deserialization_proc: WSProtocolHandlerDeserializationProcPtr,
context: *mut WSClientContext,
);
}