objc2_foundation/generated/
NSPropertyList.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ptr::NonNull;
4use objc2::__framework_prelude::*;
5
6use crate::*;
7
8/// [Apple's documentation](https://developer.apple.com/documentation/foundation/nspropertylistmutabilityoptions?language=objc)
9// NS_OPTIONS
10#[repr(transparent)]
11#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
12pub struct NSPropertyListMutabilityOptions(pub NSUInteger);
13bitflags::bitflags! {
14    impl NSPropertyListMutabilityOptions: NSUInteger {
15        #[doc(alias = "NSPropertyListImmutable")]
16        const Immutable = 0;
17        #[doc(alias = "NSPropertyListMutableContainers")]
18        const MutableContainers = 1;
19        #[doc(alias = "NSPropertyListMutableContainersAndLeaves")]
20        const MutableContainersAndLeaves = 2;
21    }
22}
23
24unsafe impl Encode for NSPropertyListMutabilityOptions {
25    const ENCODING: Encoding = NSUInteger::ENCODING;
26}
27
28unsafe impl RefEncode for NSPropertyListMutabilityOptions {
29    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
30}
31
32/// [Apple's documentation](https://developer.apple.com/documentation/foundation/nspropertylistformat?language=objc)
33// NS_ENUM
34#[repr(transparent)]
35#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
36pub struct NSPropertyListFormat(pub NSUInteger);
37impl NSPropertyListFormat {
38    #[doc(alias = "NSPropertyListOpenStepFormat")]
39    pub const OpenStepFormat: Self = Self(1);
40    #[doc(alias = "NSPropertyListXMLFormat_v1_0")]
41    pub const XMLFormat_v1_0: Self = Self(100);
42    #[doc(alias = "NSPropertyListBinaryFormat_v1_0")]
43    pub const BinaryFormat_v1_0: Self = Self(200);
44}
45
46unsafe impl Encode for NSPropertyListFormat {
47    const ENCODING: Encoding = NSUInteger::ENCODING;
48}
49
50unsafe impl RefEncode for NSPropertyListFormat {
51    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
52}
53
54/// [Apple's documentation](https://developer.apple.com/documentation/foundation/nspropertylistreadoptions?language=objc)
55pub type NSPropertyListReadOptions = NSPropertyListMutabilityOptions;
56
57/// [Apple's documentation](https://developer.apple.com/documentation/foundation/nspropertylistwriteoptions?language=objc)
58pub type NSPropertyListWriteOptions = NSUInteger;
59
60extern_class!(
61    /// [Apple's documentation](https://developer.apple.com/documentation/foundation/nspropertylistserialization?language=objc)
62    #[unsafe(super(NSObject))]
63    #[derive(Debug, PartialEq, Eq, Hash)]
64    pub struct NSPropertyListSerialization;
65);
66
67extern_conformance!(
68    unsafe impl NSObjectProtocol for NSPropertyListSerialization {}
69);
70
71impl NSPropertyListSerialization {
72    extern_methods!(
73        #[unsafe(method(propertyList:isValidForFormat:))]
74        #[unsafe(method_family = none)]
75        pub unsafe fn propertyList_isValidForFormat(
76            plist: &AnyObject,
77            format: NSPropertyListFormat,
78        ) -> bool;
79
80        #[cfg(all(feature = "NSData", feature = "NSError"))]
81        #[unsafe(method(dataWithPropertyList:format:options:error:_))]
82        #[unsafe(method_family = none)]
83        pub unsafe fn dataWithPropertyList_format_options_error(
84            plist: &AnyObject,
85            format: NSPropertyListFormat,
86            opt: NSPropertyListWriteOptions,
87        ) -> Result<Retained<NSData>, Retained<NSError>>;
88
89        #[cfg(all(feature = "NSData", feature = "NSError"))]
90        #[unsafe(method(propertyListWithData:options:format:error:_))]
91        #[unsafe(method_family = none)]
92        pub unsafe fn propertyListWithData_options_format_error(
93            data: &NSData,
94            opt: NSPropertyListReadOptions,
95            format: *mut NSPropertyListFormat,
96        ) -> Result<Retained<AnyObject>, Retained<NSError>>;
97
98        #[cfg(all(feature = "NSError", feature = "NSStream"))]
99        #[unsafe(method(propertyListWithStream:options:format:error:_))]
100        #[unsafe(method_family = none)]
101        pub unsafe fn propertyListWithStream_options_format_error(
102            stream: &NSInputStream,
103            opt: NSPropertyListReadOptions,
104            format: *mut NSPropertyListFormat,
105        ) -> Result<Retained<AnyObject>, Retained<NSError>>;
106
107        #[cfg(all(feature = "NSData", feature = "NSString"))]
108        #[deprecated = "Use dataWithPropertyList:format:options:error: instead."]
109        #[unsafe(method(dataFromPropertyList:format:errorDescription:))]
110        #[unsafe(method_family = none)]
111        pub unsafe fn dataFromPropertyList_format_errorDescription(
112            plist: &AnyObject,
113            format: NSPropertyListFormat,
114            error_string: *mut *mut NSString,
115        ) -> Option<Retained<NSData>>;
116
117        #[cfg(all(feature = "NSData", feature = "NSString"))]
118        #[deprecated = "Use propertyListWithData:options:format:error: instead."]
119        #[unsafe(method(propertyListFromData:mutabilityOption:format:errorDescription:))]
120        #[unsafe(method_family = none)]
121        pub unsafe fn propertyListFromData_mutabilityOption_format_errorDescription(
122            data: &NSData,
123            opt: NSPropertyListMutabilityOptions,
124            format: *mut NSPropertyListFormat,
125            error_string: *mut *mut NSString,
126        ) -> Option<Retained<AnyObject>>;
127    );
128}
129
130/// Methods declared on superclass `NSObject`.
131impl NSPropertyListSerialization {
132    extern_methods!(
133        #[unsafe(method(init))]
134        #[unsafe(method_family = init)]
135        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
136
137        #[unsafe(method(new))]
138        #[unsafe(method_family = new)]
139        pub unsafe fn new() -> Retained<Self>;
140    );
141}