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"))]
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 unsafe 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:))]
77        #[unsafe(method_family = init)]
78        pub unsafe fn initWithCoder(
79            this: Allocated<Self>,
80            coder: &NSCoder,
81        ) -> Option<Retained<Self>>;
82
83        #[unsafe(method(compoundPredicateType))]
84        #[unsafe(method_family = none)]
85        pub unsafe fn compoundPredicateType(&self) -> NSCompoundPredicateType;
86
87        #[cfg(feature = "NSArray")]
88        #[unsafe(method(subpredicates))]
89        #[unsafe(method_family = none)]
90        pub unsafe fn subpredicates(&self) -> Retained<NSArray>;
91
92        #[cfg(feature = "NSArray")]
93        /// * Convenience Methods **
94        #[unsafe(method(andPredicateWithSubpredicates:))]
95        #[unsafe(method_family = none)]
96        pub unsafe fn andPredicateWithSubpredicates(
97            subpredicates: &NSArray<NSPredicate>,
98        ) -> Retained<NSCompoundPredicate>;
99
100        #[cfg(feature = "NSArray")]
101        #[unsafe(method(orPredicateWithSubpredicates:))]
102        #[unsafe(method_family = none)]
103        pub unsafe fn orPredicateWithSubpredicates(
104            subpredicates: &NSArray<NSPredicate>,
105        ) -> Retained<NSCompoundPredicate>;
106
107        #[unsafe(method(notPredicateWithSubpredicate:))]
108        #[unsafe(method_family = none)]
109        pub unsafe fn notPredicateWithSubpredicate(
110            predicate: &NSPredicate,
111        ) -> Retained<NSCompoundPredicate>;
112    );
113}
114
115/// Methods declared on superclass `NSObject`.
116#[cfg(feature = "NSPredicate")]
117impl NSCompoundPredicate {
118    extern_methods!(
119        #[unsafe(method(init))]
120        #[unsafe(method_family = init)]
121        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
122
123        #[unsafe(method(new))]
124        #[unsafe(method_family = new)]
125        pub unsafe fn new() -> Retained<Self>;
126    );
127}