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;
use objc2::__framework_prelude::*;
use crate::*;
// NS_OPTIONS
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSPropertyListMutabilityOptions(pub NSUInteger);
bitflags::bitflags! {
impl NSPropertyListMutabilityOptions: NSUInteger {
#[doc(alias = "NSPropertyListImmutable")]
const Immutable = 0;
#[doc(alias = "NSPropertyListMutableContainers")]
const MutableContainers = 1;
#[doc(alias = "NSPropertyListMutableContainersAndLeaves")]
const MutableContainersAndLeaves = 2;
}
}
unsafe impl Encode for NSPropertyListMutabilityOptions {
const ENCODING: Encoding = NSUInteger::ENCODING;
}
unsafe impl RefEncode for NSPropertyListMutabilityOptions {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSPropertyListFormat(pub NSUInteger);
impl NSPropertyListFormat {
#[doc(alias = "NSPropertyListOpenStepFormat")]
pub const OpenStepFormat: Self = Self(1);
#[doc(alias = "NSPropertyListXMLFormat_v1_0")]
pub const XMLFormat_v1_0: Self = Self(100);
#[doc(alias = "NSPropertyListBinaryFormat_v1_0")]
pub const BinaryFormat_v1_0: Self = Self(200);
}
unsafe impl Encode for NSPropertyListFormat {
const ENCODING: Encoding = NSUInteger::ENCODING;
}
unsafe impl RefEncode for NSPropertyListFormat {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
pub type NSPropertyListReadOptions = NSPropertyListMutabilityOptions;
pub type NSPropertyListWriteOptions = NSUInteger;
extern_class!(
#[unsafe(super(NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct NSPropertyListSerialization;
);
extern_conformance!(
unsafe impl NSObjectProtocol for NSPropertyListSerialization {}
);
impl NSPropertyListSerialization {
extern_methods!(
/// # Safety
///
/// `plist` should be of the correct type.
#[unsafe(method(propertyList:isValidForFormat:))]
#[unsafe(method_family = none)]
pub unsafe fn propertyList_isValidForFormat(
plist: &AnyObject,
format: NSPropertyListFormat,
) -> bool;
#[cfg(all(feature = "NSData", feature = "NSError"))]
/// # Safety
///
/// `plist` should be of the correct type.
#[unsafe(method(dataWithPropertyList:format:options:error:_))]
#[unsafe(method_family = none)]
pub unsafe fn dataWithPropertyList_format_options_error(
plist: &AnyObject,
format: NSPropertyListFormat,
opt: NSPropertyListWriteOptions,
) -> Result<Retained<NSData>, Retained<NSError>>;
#[cfg(all(feature = "NSData", feature = "NSError"))]
/// # Safety
///
/// `format` must be a valid pointer or null.
#[unsafe(method(propertyListWithData:options:format:error:_))]
#[unsafe(method_family = none)]
pub unsafe fn propertyListWithData_options_format_error(
data: &NSData,
opt: NSPropertyListReadOptions,
format: *mut NSPropertyListFormat,
) -> Result<Retained<AnyObject>, Retained<NSError>>;
#[cfg(all(feature = "NSError", feature = "NSStream"))]
/// # Safety
///
/// `format` must be a valid pointer or null.
#[unsafe(method(propertyListWithStream:options:format:error:_))]
#[unsafe(method_family = none)]
pub unsafe fn propertyListWithStream_options_format_error(
stream: &NSInputStream,
opt: NSPropertyListReadOptions,
format: *mut NSPropertyListFormat,
) -> Result<Retained<AnyObject>, Retained<NSError>>;
#[cfg(all(feature = "NSData", feature = "NSString"))]
/// # Safety
///
/// - `plist` should be of the correct type.
/// - `error_string` must be a valid pointer or null.
#[deprecated = "Use dataWithPropertyList:format:options:error: instead."]
#[unsafe(method(dataFromPropertyList:format:errorDescription:))]
#[unsafe(method_family = none)]
pub unsafe fn dataFromPropertyList_format_errorDescription(
plist: &AnyObject,
format: NSPropertyListFormat,
error_string: *mut *mut NSString,
) -> Option<Retained<NSData>>;
#[cfg(all(feature = "NSData", feature = "NSString"))]
/// # Safety
///
/// - `format` must be a valid pointer or null.
/// - `error_string` must be a valid pointer or null.
#[deprecated = "Use propertyListWithData:options:format:error: instead."]
#[unsafe(method(propertyListFromData:mutabilityOption:format:errorDescription:))]
#[unsafe(method_family = none)]
pub unsafe fn propertyListFromData_mutabilityOption_format_errorDescription(
data: &NSData,
opt: NSPropertyListMutabilityOptions,
format: *mut NSPropertyListFormat,
error_string: *mut *mut NSString,
) -> Option<Retained<AnyObject>>;
);
}
/// Methods declared on superclass `NSObject`.
impl NSPropertyListSerialization {
extern_methods!(
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub fn init(this: Allocated<Self>) -> Retained<Self>;
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub fn new() -> Retained<Self>;
);
}
impl DefaultRetained for NSPropertyListSerialization {
#[inline]
fn default_retained() -> Retained<Self> {
Self::new()
}
}