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        #[unsafe(method(initWithCoder:))]
64        #[unsafe(method_family = init)]
65        pub unsafe fn initWithCoder(this: Allocated<Self>, a_decoder: &NSCoder) -> Retained<Self>;
66
67        #[cfg(feature = "CKRecord")]
68        /// Use
69        ///
70        /// ```text
71        ///  [NSPredicate predicateWithValue:YES] / NSPredicate(value: true)
72        /// ```
73        ///
74        /// if you want to query for all records of a given type.
75        #[unsafe(method(initWithRecordType:predicate:))]
76        #[unsafe(method_family = init)]
77        pub unsafe fn initWithRecordType_predicate(
78            this: Allocated<Self>,
79            record_type: &CKRecordType,
80            predicate: &NSPredicate,
81        ) -> Retained<Self>;
82
83        #[cfg(feature = "CKRecord")]
84        #[unsafe(method(recordType))]
85        #[unsafe(method_family = none)]
86        pub unsafe fn recordType(&self) -> Retained<CKRecordType>;
87
88        #[unsafe(method(predicate))]
89        #[unsafe(method_family = none)]
90        pub unsafe fn predicate(&self) -> Retained<NSPredicate>;
91
92        #[unsafe(method(sortDescriptors))]
93        #[unsafe(method_family = none)]
94        pub unsafe fn sortDescriptors(&self) -> Option<Retained<NSArray<NSSortDescriptor>>>;
95
96        /// Setter for [`sortDescriptors`][Self::sortDescriptors].
97        #[unsafe(method(setSortDescriptors:))]
98        #[unsafe(method_family = none)]
99        pub unsafe fn setSortDescriptors(
100            &self,
101            sort_descriptors: Option<&NSArray<NSSortDescriptor>>,
102        );
103    );
104}