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
51unsafe impl NSCoding for CKRecordZone {}
52
53unsafe impl NSCopying for CKRecordZone {}
54
55unsafe impl CopyingHelper for CKRecordZone {
56    type Result = Self;
57}
58
59unsafe impl NSObjectProtocol for CKRecordZone {}
60
61unsafe impl NSSecureCoding for CKRecordZone {}
62
63impl CKRecordZone {
64    extern_methods!(
65        #[unsafe(method(defaultRecordZone))]
66        #[unsafe(method_family = none)]
67        pub unsafe fn defaultRecordZone() -> Retained<CKRecordZone>;
68
69        #[unsafe(method(init))]
70        #[unsafe(method_family = init)]
71        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
72
73        #[unsafe(method(new))]
74        #[unsafe(method_family = new)]
75        pub unsafe fn new() -> Retained<Self>;
76
77        #[unsafe(method(initWithZoneName:))]
78        #[unsafe(method_family = init)]
79        pub unsafe fn initWithZoneName(
80            this: Allocated<Self>,
81            zone_name: &NSString,
82        ) -> Retained<Self>;
83
84        #[cfg(feature = "CKRecordZoneID")]
85        #[unsafe(method(initWithZoneID:))]
86        #[unsafe(method_family = init)]
87        pub unsafe fn initWithZoneID(
88            this: Allocated<Self>,
89            zone_id: &CKRecordZoneID,
90        ) -> Retained<Self>;
91
92        #[cfg(feature = "CKRecordZoneID")]
93        #[unsafe(method(zoneID))]
94        #[unsafe(method_family = none)]
95        pub unsafe fn zoneID(&self) -> Retained<CKRecordZoneID>;
96
97        /// 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.
98        #[unsafe(method(capabilities))]
99        #[unsafe(method_family = none)]
100        pub unsafe fn capabilities(&self) -> CKRecordZoneCapabilities;
101
102        #[cfg(feature = "CKReference")]
103        /// The share property on a record zone will only be set on zones fetched from the server and only if a
104        /// corresponding zone-wide share record for the zone exists on the server.
105        ///
106        /// You can create a zone-wide share for a zone using
107        ///
108        /// ```text
109        ///  -[CKShare initWithRecordZoneID:]
110        /// ```
111        ///
112        /// .
113        ///
114        /// Zone-wide sharing is only supported in zones with the
115        /// `CKRecordZoneCapabilityZoneWideSharing`sharing capability.
116        /// You cannot share a zone if it already contains shared records.
117        #[unsafe(method(share))]
118        #[unsafe(method_family = none)]
119        pub unsafe fn share(&self) -> Option<Retained<CKReference>>;
120    );
121}