Source code

Revision control

Copy as Markdown

Other Tools

//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use core::ptr::NonNull;
#[cfg(feature = "objc2")]
use objc2::__framework_prelude::*;
use crate::*;
#[cfg(feature = "CFURL")]
impl CFURL {
/// # Safety
///
/// - `alloc` might not allow `None`.
/// - `url` might not allow `None`.
/// - `resource_data` must be a valid pointer.
/// - `properties` must be a valid pointer.
/// - `desired_properties` generic must be of the correct type.
/// - `desired_properties` might not allow `None`.
/// - `error_code` must be a valid pointer.
#[doc(alias = "CFURLCreateDataAndPropertiesFromResource")]
#[cfg(all(
feature = "CFArray",
feature = "CFData",
feature = "CFDictionary",
feature = "CFURL"
))]
#[deprecated = "For resource data, use the CFReadStream API. For file resource properties, use CFURLCopyResourcePropertiesForKeys."]
#[inline]
pub unsafe fn new_data_and_properties_from_resource(
alloc: Option<&CFAllocator>,
url: Option<&CFURL>,
resource_data: *mut *const CFData,
properties: *mut *const CFDictionary,
desired_properties: Option<&CFArray>,
error_code: *mut i32,
) -> bool {
extern "C-unwind" {
fn CFURLCreateDataAndPropertiesFromResource(
alloc: Option<&CFAllocator>,
url: Option<&CFURL>,
resource_data: *mut *const CFData,
properties: *mut *const CFDictionary,
desired_properties: Option<&CFArray>,
error_code: *mut i32,
) -> Boolean;
}
let ret = unsafe {
CFURLCreateDataAndPropertiesFromResource(
alloc,
url,
resource_data,
properties,
desired_properties,
error_code,
)
};
ret != 0
}
/// # Safety
///
/// - `data_to_write` might not allow `None`.
/// - `properties_to_write` generics must be of the correct type.
/// - `properties_to_write` might not allow `None`.
/// - `error_code` must be a valid pointer.
#[doc(alias = "CFURLWriteDataAndPropertiesToResource")]
#[cfg(all(feature = "CFData", feature = "CFDictionary", feature = "CFURL"))]
#[deprecated = "For resource data, use the CFWriteStream API. For file resource properties, use CFURLSetResourcePropertiesForKeys."]
#[inline]
pub unsafe fn write_data_and_properties_to_resource(
&self,
data_to_write: Option<&CFData>,
properties_to_write: Option<&CFDictionary>,
error_code: *mut i32,
) -> bool {
extern "C-unwind" {
fn CFURLWriteDataAndPropertiesToResource(
url: &CFURL,
data_to_write: Option<&CFData>,
properties_to_write: Option<&CFDictionary>,
error_code: *mut i32,
) -> Boolean;
}
let ret = unsafe {
CFURLWriteDataAndPropertiesToResource(
self,
data_to_write,
properties_to_write,
error_code,
)
};
ret != 0
}
/// # Safety
///
/// `error_code` must be a valid pointer.
#[doc(alias = "CFURLDestroyResource")]
#[cfg(feature = "CFURL")]
#[deprecated = "Use CFURLGetFileSystemRepresentation and removefile(3) instead."]
#[inline]
pub unsafe fn destroy_resource(&self, error_code: *mut i32) -> bool {
extern "C-unwind" {
fn CFURLDestroyResource(url: &CFURL, error_code: *mut i32) -> Boolean;
}
let ret = unsafe { CFURLDestroyResource(self, error_code) };
ret != 0
}
/// # Safety
///
/// - `alloc` might not allow `None`.
/// - `url` might not allow `None`.
/// - `property` might not allow `None`.
/// - `error_code` must be a valid pointer.
#[doc(alias = "CFURLCreatePropertyFromResource")]
#[cfg(feature = "CFURL")]
#[deprecated = "For file resource properties, use CFURLCopyResourcePropertyForKey."]
#[inline]
pub unsafe fn new_property_from_resource(
alloc: Option<&CFAllocator>,
url: Option<&CFURL>,
property: Option<&CFString>,
error_code: *mut i32,
) -> Option<CFRetained<CFType>> {
extern "C-unwind" {
fn CFURLCreatePropertyFromResource(
alloc: Option<&CFAllocator>,
url: Option<&CFURL>,
property: Option<&CFString>,
error_code: *mut i32,
) -> Option<NonNull<CFType>>;
}
let ret = unsafe { CFURLCreatePropertyFromResource(alloc, url, property, error_code) };
ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
}
}
// NS_ENUM
#[deprecated = "Use CFError codes instead"]
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct CFURLError(pub CFIndex);
impl CFURLError {
#[doc(alias = "kCFURLUnknownError")]
#[deprecated = "Use CFError codes instead"]
pub const UnknownError: Self = Self(-10);
#[doc(alias = "kCFURLUnknownSchemeError")]
#[deprecated = "Use CFError codes instead"]
pub const UnknownSchemeError: Self = Self(-11);
#[doc(alias = "kCFURLResourceNotFoundError")]
#[deprecated = "Use CFError codes instead"]
pub const ResourceNotFoundError: Self = Self(-12);
#[doc(alias = "kCFURLResourceAccessViolationError")]
#[deprecated = "Use CFError codes instead"]
pub const ResourceAccessViolationError: Self = Self(-13);
#[doc(alias = "kCFURLRemoteHostUnavailableError")]
#[deprecated = "Use CFError codes instead"]
pub const RemoteHostUnavailableError: Self = Self(-14);
#[doc(alias = "kCFURLImproperArgumentsError")]
#[deprecated = "Use CFError codes instead"]
pub const ImproperArgumentsError: Self = Self(-15);
#[doc(alias = "kCFURLUnknownPropertyKeyError")]
#[deprecated = "Use CFError codes instead"]
pub const UnknownPropertyKeyError: Self = Self(-16);
#[doc(alias = "kCFURLPropertyKeyUnavailableError")]
#[deprecated = "Use CFError codes instead"]
pub const PropertyKeyUnavailableError: Self = Self(-17);
#[doc(alias = "kCFURLTimeoutError")]
#[deprecated = "Use CFError codes instead"]
pub const TimeoutError: Self = Self(-18);
}
#[cfg(feature = "objc2")]
unsafe impl Encode for CFURLError {
const ENCODING: Encoding = CFIndex::ENCODING;
}
#[cfg(feature = "objc2")]
unsafe impl RefEncode for CFURLError {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
extern "C" {
#[deprecated = "Use CFURLResourceIsReachable instead."]
pub static kCFURLFileExists: Option<&'static CFString>;
}
extern "C" {
#[deprecated = "Use the CFURLEnumerator API instead."]
pub static kCFURLFileDirectoryContents: Option<&'static CFString>;
}
extern "C" {
#[deprecated = "Use CFURLCopyResourcePropertyForKey with kCFURLFileSizeKey instead."]
pub static kCFURLFileLength: Option<&'static CFString>;
}
extern "C" {
#[deprecated = "Use CFURLCopyResourcePropertyForKey with kCFURLContentModificationDateKey instead."]
pub static kCFURLFileLastModificationTime: Option<&'static CFString>;
}
extern "C" {
#[deprecated = "Use CFURLCopyResourcePropertyForKey with kCFURLFileSecurityKey and then the CFFileSecurity API instead."]
pub static kCFURLFilePOSIXMode: Option<&'static CFString>;
}
extern "C" {
#[deprecated = "Use CFURLCopyResourcePropertyForKey with kCFURLFileSecurityKey and then the CFFileSecurity API instead."]
pub static kCFURLFileOwnerID: Option<&'static CFString>;
}
extern "C" {
#[deprecated = "Use NSHTTPURLResponse methods instead."]
pub static kCFURLHTTPStatusCode: Option<&'static CFString>;
}
extern "C" {
#[deprecated = "Use NSHTTPURLResponse methods instead."]
pub static kCFURLHTTPStatusLine: Option<&'static CFString>;
}
#[cfg(all(
feature = "CFArray",
feature = "CFData",
feature = "CFDictionary",
feature = "CFURL"
))]
#[deprecated = "renamed to `CFURL::new_data_and_properties_from_resource`"]
#[inline]
pub unsafe extern "C-unwind" fn CFURLCreateDataAndPropertiesFromResource(
alloc: Option<&CFAllocator>,
url: Option<&CFURL>,
resource_data: *mut *const CFData,
properties: *mut *const CFDictionary,
desired_properties: Option<&CFArray>,
error_code: *mut i32,
) -> bool {
extern "C-unwind" {
fn CFURLCreateDataAndPropertiesFromResource(
alloc: Option<&CFAllocator>,
url: Option<&CFURL>,
resource_data: *mut *const CFData,
properties: *mut *const CFDictionary,
desired_properties: Option<&CFArray>,
error_code: *mut i32,
) -> Boolean;
}
let ret = unsafe {
CFURLCreateDataAndPropertiesFromResource(
alloc,
url,
resource_data,
properties,
desired_properties,
error_code,
)
};
ret != 0
}
#[cfg(all(feature = "CFData", feature = "CFDictionary", feature = "CFURL"))]
#[deprecated = "renamed to `CFURL::write_data_and_properties_to_resource`"]
#[inline]
pub unsafe extern "C-unwind" fn CFURLWriteDataAndPropertiesToResource(
url: &CFURL,
data_to_write: Option<&CFData>,
properties_to_write: Option<&CFDictionary>,
error_code: *mut i32,
) -> bool {
extern "C-unwind" {
fn CFURLWriteDataAndPropertiesToResource(
url: &CFURL,
data_to_write: Option<&CFData>,
properties_to_write: Option<&CFDictionary>,
error_code: *mut i32,
) -> Boolean;
}
let ret = unsafe {
CFURLWriteDataAndPropertiesToResource(url, data_to_write, properties_to_write, error_code)
};
ret != 0
}
#[cfg(feature = "CFURL")]
#[deprecated = "renamed to `CFURL::destroy_resource`"]
#[inline]
pub unsafe extern "C-unwind" fn CFURLDestroyResource(url: &CFURL, error_code: *mut i32) -> bool {
extern "C-unwind" {
fn CFURLDestroyResource(url: &CFURL, error_code: *mut i32) -> Boolean;
}
let ret = unsafe { CFURLDestroyResource(url, error_code) };
ret != 0
}
#[cfg(feature = "CFURL")]
#[deprecated = "renamed to `CFURL::new_property_from_resource`"]
#[inline]
pub unsafe extern "C-unwind" fn CFURLCreatePropertyFromResource(
alloc: Option<&CFAllocator>,
url: Option<&CFURL>,
property: Option<&CFString>,
error_code: *mut i32,
) -> Option<CFRetained<CFType>> {
extern "C-unwind" {
fn CFURLCreatePropertyFromResource(
alloc: Option<&CFAllocator>,
url: Option<&CFURL>,
property: Option<&CFString>,
error_code: *mut i32,
) -> Option<NonNull<CFType>>;
}
let ret = unsafe { CFURLCreatePropertyFromResource(alloc, url, property, error_code) };
ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
}