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
33unsafe impl NSCoding for CKQuery {}
34
35unsafe impl NSCopying for CKQuery {}
36
37unsafe impl CopyingHelper for CKQuery {
38    type Result = Self;
39}
40
41unsafe impl NSObjectProtocol for CKQuery {}
42
43unsafe impl NSSecureCoding for CKQuery {}
44
45impl CKQuery {
46    extern_methods!(
47        #[unsafe(method(init))]
48        #[unsafe(method_family = init)]
49        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
50
51        #[unsafe(method(new))]
52        #[unsafe(method_family = new)]
53        pub unsafe fn new() -> Retained<Self>;
54
55        #[unsafe(method(initWithCoder:))]
56        #[unsafe(method_family = init)]
57        pub unsafe fn initWithCoder(this: Allocated<Self>, a_decoder: &NSCoder) -> Retained<Self>;
58
59        #[cfg(feature = "CKRecord")]
60        /// Use
61        ///
62        /// ```text
63        ///  [NSPredicate predicateWithValue:YES] / NSPredicate(value: true)
64        /// ```
65        ///
66        /// if you want to query for all records of a given type.
67        #[unsafe(method(initWithRecordType:predicate:))]
68        #[unsafe(method_family = init)]
69        pub unsafe fn initWithRecordType_predicate(
70            this: Allocated<Self>,
71            record_type: &CKRecordType,
72            predicate: &NSPredicate,
73        ) -> Retained<Self>;
74
75        #[cfg(feature = "CKRecord")]
76        #[unsafe(method(recordType))]
77        #[unsafe(method_family = none)]
78        pub unsafe fn recordType(&self) -> Retained<CKRecordType>;
79
80        #[unsafe(method(predicate))]
81        #[unsafe(method_family = none)]
82        pub unsafe fn predicate(&self) -> Retained<NSPredicate>;
83
84        #[unsafe(method(sortDescriptors))]
85        #[unsafe(method_family = none)]
86        pub unsafe fn sortDescriptors(&self) -> Option<Retained<NSArray<NSSortDescriptor>>>;
87
88        /// Setter for [`sortDescriptors`][Self::sortDescriptors].
89        #[unsafe(method(setSortDescriptors:))]
90        #[unsafe(method_family = none)]
91        pub unsafe fn setSortDescriptors(
92            &self,
93            sort_descriptors: Option<&NSArray<NSSortDescriptor>>,
94        );
95    );
96}