objc2_cloud_kit/generated/
CKRecordZone.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::*;
5use objc2_foundation::*;
6
7use crate::*;
8
9/// [Apple's documentation](https://developer.apple.com/documentation/cloudkit/ckrecordzonecapabilities?language=objc)
10// NS_OPTIONS
11#[repr(transparent)]
12#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
13pub struct CKRecordZoneCapabilities(pub NSUInteger);
14bitflags::bitflags! {
15    impl CKRecordZoneCapabilities: NSUInteger {
16/// This zone supports CKFetchRecordChangesOperation
17        #[doc(alias = "CKRecordZoneCapabilityFetchChanges")]
18        const FetchChanges = 1<<0;
19/// Batched changes to this zone happen atomically
20        #[doc(alias = "CKRecordZoneCapabilityAtomic")]
21        const Atomic = 1<<1;
22/// Records in this zone can be shared
23        #[doc(alias = "CKRecordZoneCapabilitySharing")]
24        const Sharing = 1<<2;
25/// This zone supports a single CKShare record that shares all records in the zone
26        #[doc(alias = "CKRecordZoneCapabilityZoneWideSharing")]
27        const ZoneWideSharing = 1<<3;
28    }
29}
30
31unsafe impl Encode for CKRecordZoneCapabilities {
32    const ENCODING: Encoding = NSUInteger::ENCODING;
33}
34
35unsafe impl RefEncode for CKRecordZoneCapabilities {
36    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
37}
38
39extern "C" {
40    /// [Apple's documentation](https://developer.apple.com/documentation/cloudkit/ckrecordzonedefaultname?language=objc)
41    pub static CKRecordZoneDefaultName: &'static NSString;
42}
43
44extern_class!(
45    /// [Apple's documentation](https://developer.apple.com/documentation/cloudkit/ckrecordzone?language=objc)
46    #[unsafe(super(NSObject))]
47    #[derive(Debug, PartialEq, Eq, Hash)]
48    pub struct CKRecordZone;
49);
50
51extern_conformance!(
52    unsafe impl NSCoding for CKRecordZone {}
53);
54
55extern_conformance!(
56    unsafe impl NSCopying for CKRecordZone {}
57);
58
59unsafe impl CopyingHelper for CKRecordZone {
60    type Result = Self;
61}
62
63extern_conformance!(
64    unsafe impl NSObjectProtocol for CKRecordZone {}
65);
66
67extern_conformance!(
68    unsafe impl NSSecureCoding for CKRecordZone {}
69);
70
71impl CKRecordZone {
72    extern_methods!(
73        #[unsafe(method(defaultRecordZone))]
74        #[unsafe(method_family = none)]
75        pub unsafe fn defaultRecordZone() -> Retained<CKRecordZone>;
76
77        #[unsafe(method(init))]
78        #[unsafe(method_family = init)]
79        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
80
81        #[unsafe(method(new))]
82        #[unsafe(method_family = new)]
83        pub unsafe fn new() -> Retained<Self>;
84
85        #[unsafe(method(initWithZoneName:))]
86        #[unsafe(method_family = init)]
87        pub unsafe fn initWithZoneName(
88            this: Allocated<Self>,
89            zone_name: &NSString,
90        ) -> Retained<Self>;
91
92        #[cfg(feature = "CKRecordZoneID")]
93        #[unsafe(method(initWithZoneID:))]
94        #[unsafe(method_family = init)]
95        pub unsafe fn initWithZoneID(
96            this: Allocated<Self>,
97            zone_id: &CKRecordZoneID,
98        ) -> Retained<Self>;
99
100        #[cfg(feature = "CKRecordZoneID")]
101        #[unsafe(method(zoneID))]
102        #[unsafe(method_family = none)]
103        pub unsafe fn zoneID(&self) -> Retained<CKRecordZoneID>;
104
105        /// Capabilities on locally-created record zones are not valid until the record zone is saved. Capabilities on record zones fetched from the server are valid.
106        #[unsafe(method(capabilities))]
107        #[unsafe(method_family = none)]
108        pub unsafe fn capabilities(&self) -> CKRecordZoneCapabilities;
109
110        #[cfg(feature = "CKReference")]
111        /// The share property on a record zone will only be set on zones fetched from the server and only if a
112        /// corresponding zone-wide share record for the zone exists on the server.
113        ///
114        /// You can create a zone-wide share for a zone using
115        ///
116        /// ```text
117        ///  -[CKShare initWithRecordZoneID:]
118        /// ```
119        ///
120        /// .
121        ///
122        /// Zone-wide sharing is only supported in zones with the
123        /// `CKRecordZoneCapabilityZoneWideSharing`sharing capability.
124        /// You cannot share a zone if it already contains shared records.
125        #[unsafe(method(share))]
126        #[unsafe(method_family = none)]
127        pub unsafe fn share(&self) -> Option<Retained<CKReference>>;
128    );
129}