objc2_foundation/generated/
NSCompoundPredicate.rs1use core::ptr::NonNull;
4use objc2::__framework_prelude::*;
5
6use crate::*;
7
8#[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 #[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"))]
39extern_conformance!(
40 unsafe impl NSCoding for NSCompoundPredicate {}
41);
42
43#[cfg(all(feature = "NSObject", feature = "NSPredicate"))]
44extern_conformance!(
45 unsafe impl NSCopying for NSCompoundPredicate {}
46);
47
48#[cfg(all(feature = "NSObject", feature = "NSPredicate"))]
49unsafe impl CopyingHelper for NSCompoundPredicate {
50 type Result = Self;
51}
52
53#[cfg(feature = "NSPredicate")]
54extern_conformance!(
55 unsafe impl NSObjectProtocol for NSCompoundPredicate {}
56);
57
58#[cfg(all(feature = "NSObject", feature = "NSPredicate"))]
59extern_conformance!(
60 unsafe impl NSSecureCoding for NSCompoundPredicate {}
61);
62
63#[cfg(feature = "NSPredicate")]
64impl NSCompoundPredicate {
65 extern_methods!(
66 #[cfg(feature = "NSArray")]
67 #[unsafe(method(initWithType:subpredicates:))]
68 #[unsafe(method_family = init)]
69 pub fn initWithType_subpredicates(
70 this: Allocated<Self>,
71 r#type: NSCompoundPredicateType,
72 subpredicates: &NSArray<NSPredicate>,
73 ) -> Retained<Self>;
74
75 #[cfg(feature = "NSCoder")]
76 #[unsafe(method(initWithCoder:))]
80 #[unsafe(method_family = init)]
81 pub unsafe fn initWithCoder(
82 this: Allocated<Self>,
83 coder: &NSCoder,
84 ) -> Option<Retained<Self>>;
85
86 #[unsafe(method(compoundPredicateType))]
87 #[unsafe(method_family = none)]
88 pub fn compoundPredicateType(&self) -> NSCompoundPredicateType;
89
90 #[cfg(feature = "NSArray")]
91 #[unsafe(method(subpredicates))]
92 #[unsafe(method_family = none)]
93 pub fn subpredicates(&self) -> Retained<NSArray>;
94
95 #[cfg(feature = "NSArray")]
96 #[unsafe(method(andPredicateWithSubpredicates:))]
98 #[unsafe(method_family = none)]
99 pub fn andPredicateWithSubpredicates(
100 subpredicates: &NSArray<NSPredicate>,
101 ) -> Retained<NSCompoundPredicate>;
102
103 #[cfg(feature = "NSArray")]
104 #[unsafe(method(orPredicateWithSubpredicates:))]
105 #[unsafe(method_family = none)]
106 pub fn orPredicateWithSubpredicates(
107 subpredicates: &NSArray<NSPredicate>,
108 ) -> Retained<NSCompoundPredicate>;
109
110 #[unsafe(method(notPredicateWithSubpredicate:))]
111 #[unsafe(method_family = none)]
112 pub fn notPredicateWithSubpredicate(
113 predicate: &NSPredicate,
114 ) -> Retained<NSCompoundPredicate>;
115 );
116}
117
118#[cfg(feature = "NSPredicate")]
120impl NSCompoundPredicate {
121 extern_methods!(
122 #[unsafe(method(init))]
123 #[unsafe(method_family = init)]
124 pub fn init(this: Allocated<Self>) -> Retained<Self>;
125
126 #[unsafe(method(new))]
127 #[unsafe(method_family = new)]
128 pub fn new() -> Retained<Self>;
129 );
130}
131
132#[cfg(feature = "NSPredicate")]
133impl DefaultRetained for NSCompoundPredicate {
134 #[inline]
135 fn default_retained() -> Retained<Self> {
136 Self::new()
137 }
138}