objc2_cloud_kit/generated/
CKAllowedSharingOptions.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ffi::*;
4use core::ptr::NonNull;
5use objc2::__framework_prelude::*;
6use objc2_foundation::*;
7
8use crate::*;
9
10/// [Apple's documentation](https://developer.apple.com/documentation/cloudkit/cksharingparticipantaccessoption?language=objc)
11// NS_OPTIONS
12#[repr(transparent)]
13#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
14pub struct CKSharingParticipantAccessOption(pub NSUInteger);
15bitflags::bitflags! {
16    impl CKSharingParticipantAccessOption: NSUInteger {
17/// If specified, the system sharing UI will allow the user to share publicly i.e. anyone with the link has access.
18        #[doc(alias = "CKSharingParticipantAccessOptionAnyoneWithLink")]
19        const AnyoneWithLink = 1<<0;
20/// If specified, the system sharing UI will allow the user to share privately to specified recipients.
21        #[doc(alias = "CKSharingParticipantAccessOptionSpecifiedRecipientsOnly")]
22        const SpecifiedRecipientsOnly = 1<<1;
23/// Allow the user to configure the share with either access option.
24        #[doc(alias = "CKSharingParticipantAccessOptionAny")]
25        const Any = CKSharingParticipantAccessOption::AnyoneWithLink.0|CKSharingParticipantAccessOption::SpecifiedRecipientsOnly.0;
26    }
27}
28
29unsafe impl Encode for CKSharingParticipantAccessOption {
30    const ENCODING: Encoding = NSUInteger::ENCODING;
31}
32
33unsafe impl RefEncode for CKSharingParticipantAccessOption {
34    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
35}
36
37/// [Apple's documentation](https://developer.apple.com/documentation/cloudkit/cksharingparticipantpermissionoption?language=objc)
38// NS_OPTIONS
39#[repr(transparent)]
40#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
41pub struct CKSharingParticipantPermissionOption(pub NSUInteger);
42bitflags::bitflags! {
43    impl CKSharingParticipantPermissionOption: NSUInteger {
44/// If specified, the system sharing UI will allow the user to grant participants read-only permissions.
45        #[doc(alias = "CKSharingParticipantPermissionOptionReadOnly")]
46        const ReadOnly = 1<<0;
47/// If specified, the system sharing UI will allow the user to grant participants read/write permissions.
48        #[doc(alias = "CKSharingParticipantPermissionOptionReadWrite")]
49        const ReadWrite = 1<<1;
50/// Allow the user to configure added share participants with either permission option.
51        #[doc(alias = "CKSharingParticipantPermissionOptionAny")]
52        const Any = CKSharingParticipantPermissionOption::ReadOnly.0|CKSharingParticipantPermissionOption::ReadWrite.0;
53    }
54}
55
56unsafe impl Encode for CKSharingParticipantPermissionOption {
57    const ENCODING: Encoding = NSUInteger::ENCODING;
58}
59
60unsafe impl RefEncode for CKSharingParticipantPermissionOption {
61    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
62}
63
64extern_class!(
65    /// [Apple's documentation](https://developer.apple.com/documentation/cloudkit/ckallowedsharingoptions?language=objc)
66    #[unsafe(super(NSObject))]
67    #[derive(Debug, PartialEq, Eq, Hash)]
68    pub struct CKAllowedSharingOptions;
69);
70
71unsafe impl NSCoding for CKAllowedSharingOptions {}
72
73unsafe impl NSCopying for CKAllowedSharingOptions {}
74
75unsafe impl CopyingHelper for CKAllowedSharingOptions {
76    type Result = Self;
77}
78
79unsafe impl NSObjectProtocol for CKAllowedSharingOptions {}
80
81unsafe impl NSSecureCoding for CKAllowedSharingOptions {}
82
83impl CKAllowedSharingOptions {
84    extern_methods!(
85        #[unsafe(method(initWithAllowedParticipantPermissionOptions:allowedParticipantAccessOptions:))]
86        #[unsafe(method_family = init)]
87        pub unsafe fn initWithAllowedParticipantPermissionOptions_allowedParticipantAccessOptions(
88            this: Allocated<Self>,
89            allowed_participant_permission_options: CKSharingParticipantPermissionOption,
90            allowed_participant_access_options: CKSharingParticipantAccessOption,
91        ) -> Retained<Self>;
92
93        #[unsafe(method(allowedParticipantPermissionOptions))]
94        #[unsafe(method_family = none)]
95        pub unsafe fn allowedParticipantPermissionOptions(
96            &self,
97        ) -> CKSharingParticipantPermissionOption;
98
99        /// Setter for [`allowedParticipantPermissionOptions`][Self::allowedParticipantPermissionOptions].
100        #[unsafe(method(setAllowedParticipantPermissionOptions:))]
101        #[unsafe(method_family = none)]
102        pub unsafe fn setAllowedParticipantPermissionOptions(
103            &self,
104            allowed_participant_permission_options: CKSharingParticipantPermissionOption,
105        );
106
107        #[unsafe(method(allowedParticipantAccessOptions))]
108        #[unsafe(method_family = none)]
109        pub unsafe fn allowedParticipantAccessOptions(&self) -> CKSharingParticipantAccessOption;
110
111        /// Setter for [`allowedParticipantAccessOptions`][Self::allowedParticipantAccessOptions].
112        #[unsafe(method(setAllowedParticipantAccessOptions:))]
113        #[unsafe(method_family = none)]
114        pub unsafe fn setAllowedParticipantAccessOptions(
115            &self,
116            allowed_participant_access_options: CKSharingParticipantAccessOption,
117        );
118
119        /// Standard allowed options are most permissive i.e.
120        /// `allowedParticipantPermissionOptions`=
121        /// `CKSharingParticipantPermissionOptionAny`and
122        /// `allowedParticipantAccessOptions`=
123        /// `CKSharingParticipantAccessOptionAny`
124        #[unsafe(method(standardOptions))]
125        #[unsafe(method_family = none)]
126        pub unsafe fn standardOptions() -> Retained<CKAllowedSharingOptions>;
127    );
128}
129
130/// Methods declared on superclass `NSObject`.
131impl CKAllowedSharingOptions {
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}