objc2_cloud_kit/generated/
CKQuery.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
10extern_class!(
11    /// Only AND compound predicates are allowed.
12    ///
13    /// Key names must begin with either an upper or lower case character ([a-zA-Z]) and may be followed by characters, numbers, or underscores ([0-9a-zA-Z_]). Keypaths may only resolve to the currently evaluated object, so the '.' character is not allowed in key names.
14    ///
15    /// A limited subset of classes are allowed as predicate arguments:
16    /// - NSString
17    /// - NSDate
18    /// - NSData
19    /// - NSNumber
20    /// - NSArray
21    /// - CKReference
22    /// - CKRecord
23    /// - CLLocation
24    ///
25    /// Any other class as an argument will result in an error when executing the query.
26    ///
27    /// See also [Apple's documentation](https://developer.apple.com/documentation/cloudkit/ckquery?language=objc)
28    #[unsafe(super(NSObject))]
29    #[derive(Debug, PartialEq, Eq, Hash)]
30    pub struct CKQuery;
31);
32
33extern_conformance!(
34    unsafe impl NSCoding for CKQuery {}
35);
36
37extern_conformance!(
38    unsafe impl NSCopying for CKQuery {}
39);
40
41unsafe impl CopyingHelper for CKQuery {
42    type Result = Self;
43}
44
45extern_conformance!(
46    unsafe impl NSObjectProtocol for CKQuery {}
47);
48
49extern_conformance!(
50    unsafe impl NSSecureCoding for CKQuery {}
51);
52
53impl CKQuery {
54    extern_methods!(
55        #[unsafe(method(init))]
56        #[unsafe(method_family = init)]
57        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
58
59        #[unsafe(method(new))]
60        #[unsafe(method_family = new)]
61        pub unsafe fn new() -> Retained<Self>;
62
63        /// # Safety
64        ///
65        /// `a_decoder` possibly has further requirements.
66        #[unsafe(method(initWithCoder:))]
67        #[unsafe(method_family = init)]
68        pub unsafe fn initWithCoder(this: Allocated<Self>, a_decoder: &NSCoder) -> Retained<Self>;
69
70        #[cfg(feature = "CKRecord")]
71        /// Use
72        ///
73        /// ```text
74        ///  [NSPredicate predicateWithValue:YES] / NSPredicate(value: true)
75        /// ```
76        ///
77        /// if you want to query for all records of a given type.
78        #[unsafe(method(initWithRecordType:predicate:))]
79        #[unsafe(method_family = init)]
80        pub unsafe fn initWithRecordType_predicate(
81            this: Allocated<Self>,
82            record_type: &CKRecordType,
83            predicate: &NSPredicate,
84        ) -> Retained<Self>;
85
86        #[cfg(feature = "CKRecord")]
87        #[unsafe(method(recordType))]
88        #[unsafe(method_family = none)]
89        pub unsafe fn recordType(&self) -> Retained<CKRecordType>;
90
91        #[unsafe(method(predicate))]
92        #[unsafe(method_family = none)]
93        pub unsafe fn predicate(&self) -> Retained<NSPredicate>;
94
95        #[unsafe(method(sortDescriptors))]
96        #[unsafe(method_family = none)]
97        pub unsafe fn sortDescriptors(&self) -> Option<Retained<NSArray<NSSortDescriptor>>>;
98
99        /// Setter for [`sortDescriptors`][Self::sortDescriptors].
100        ///
101        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
102        #[unsafe(method(setSortDescriptors:))]
103        #[unsafe(method_family = none)]
104        pub unsafe fn setSortDescriptors(
105            &self,
106            sort_descriptors: Option<&NSArray<NSSortDescriptor>>,
107        );
108    );
109}