objc2_foundation/generated/
NSCompoundPredicate.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::*;
5
6use crate::*;
7
8/// [Apple's documentation](https://developer.apple.com/documentation/foundation/nscompoundpredicatetype?language=objc)
9// NS_ENUM
10#[repr(transparent)]
11#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
12pub struct NSCompoundPredicateType(pub NSUInteger);
13impl NSCompoundPredicateType {
14    #[doc(alias = "NSNotPredicateType")]
15    pub const NotPredicateType: Self = Self(0);
16    #[doc(alias = "NSAndPredicateType")]
17    pub const AndPredicateType: Self = Self(1);
18    #[doc(alias = "NSOrPredicateType")]
19    pub const OrPredicateType: Self = Self(2);
20}
21
22unsafe impl Encode for NSCompoundPredicateType {
23    const ENCODING: Encoding = NSUInteger::ENCODING;
24}
25
26unsafe impl RefEncode for NSCompoundPredicateType {
27    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
28}
29
30extern_class!(
31    /// [Apple's documentation](https://developer.apple.com/documentation/foundation/nscompoundpredicate?language=objc)
32    #[unsafe(super(NSPredicate, NSObject))]
33    #[derive(Debug, PartialEq, Eq, Hash)]
34    #[cfg(feature = "NSPredicate")]
35    pub struct NSCompoundPredicate;
36);
37
38#[cfg(all(feature = "NSObject", feature = "NSPredicate"))]
39unsafe impl NSCoding for NSCompoundPredicate {}
40
41#[cfg(all(feature = "NSObject", feature = "NSPredicate"))]
42unsafe impl NSCopying for NSCompoundPredicate {}
43
44#[cfg(all(feature = "NSObject", feature = "NSPredicate"))]
45unsafe impl CopyingHelper for NSCompoundPredicate {
46    type Result = Self;
47}
48
49#[cfg(feature = "NSPredicate")]
50unsafe impl NSObjectProtocol for NSCompoundPredicate {}
51
52#[cfg(all(feature = "NSObject", feature = "NSPredicate"))]
53unsafe impl NSSecureCoding for NSCompoundPredicate {}
54
55#[cfg(feature = "NSPredicate")]
56impl NSCompoundPredicate {
57    extern_methods!(
58        #[cfg(feature = "NSArray")]
59        #[unsafe(method(initWithType:subpredicates:))]
60        #[unsafe(method_family = init)]
61        pub unsafe fn initWithType_subpredicates(
62            this: Allocated<Self>,
63            r#type: NSCompoundPredicateType,
64            subpredicates: &NSArray<NSPredicate>,
65        ) -> Retained<Self>;
66
67        #[cfg(feature = "NSCoder")]
68        #[unsafe(method(initWithCoder:))]
69        #[unsafe(method_family = init)]
70        pub unsafe fn initWithCoder(
71            this: Allocated<Self>,
72            coder: &NSCoder,
73        ) -> Option<Retained<Self>>;
74
75        #[unsafe(method(compoundPredicateType))]
76        #[unsafe(method_family = none)]
77        pub unsafe fn compoundPredicateType(&self) -> NSCompoundPredicateType;
78
79        #[cfg(feature = "NSArray")]
80        #[unsafe(method(subpredicates))]
81        #[unsafe(method_family = none)]
82        pub unsafe fn subpredicates(&self) -> Retained<NSArray>;
83
84        #[cfg(feature = "NSArray")]
85        /// * Convenience Methods **
86        #[unsafe(method(andPredicateWithSubpredicates:))]
87        #[unsafe(method_family = none)]
88        pub unsafe fn andPredicateWithSubpredicates(
89            subpredicates: &NSArray<NSPredicate>,
90        ) -> Retained<NSCompoundPredicate>;
91
92        #[cfg(feature = "NSArray")]
93        #[unsafe(method(orPredicateWithSubpredicates:))]
94        #[unsafe(method_family = none)]
95        pub unsafe fn orPredicateWithSubpredicates(
96            subpredicates: &NSArray<NSPredicate>,
97        ) -> Retained<NSCompoundPredicate>;
98
99        #[unsafe(method(notPredicateWithSubpredicate:))]
100        #[unsafe(method_family = none)]
101        pub unsafe fn notPredicateWithSubpredicate(
102            predicate: &NSPredicate,
103        ) -> Retained<NSCompoundPredicate>;
104    );
105}
106
107/// Methods declared on superclass `NSObject`.
108#[cfg(feature = "NSPredicate")]
109impl NSCompoundPredicate {
110    extern_methods!(
111        #[unsafe(method(init))]
112        #[unsafe(method_family = init)]
113        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
114
115        #[unsafe(method(new))]
116        #[unsafe(method_family = new)]
117        pub unsafe fn new() -> Retained<Self>;
118    );
119}