objc2_core_data/generated/
NSAttributeDescription.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
10/// [Apple's documentation](https://developer.apple.com/documentation/coredata/nsattributetype?language=objc)
11// NS_ENUM
12#[repr(transparent)]
13#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
14pub struct NSAttributeType(pub NSUInteger);
15impl NSAttributeType {
16    #[doc(alias = "NSUndefinedAttributeType")]
17    pub const UndefinedAttributeType: Self = Self(0);
18    #[doc(alias = "NSInteger16AttributeType")]
19    pub const Integer16AttributeType: Self = Self(100);
20    #[doc(alias = "NSInteger32AttributeType")]
21    pub const Integer32AttributeType: Self = Self(200);
22    #[doc(alias = "NSInteger64AttributeType")]
23    pub const Integer64AttributeType: Self = Self(300);
24    #[doc(alias = "NSDecimalAttributeType")]
25    pub const DecimalAttributeType: Self = Self(400);
26    #[doc(alias = "NSDoubleAttributeType")]
27    pub const DoubleAttributeType: Self = Self(500);
28    #[doc(alias = "NSFloatAttributeType")]
29    pub const FloatAttributeType: Self = Self(600);
30    #[doc(alias = "NSStringAttributeType")]
31    pub const StringAttributeType: Self = Self(700);
32    #[doc(alias = "NSBooleanAttributeType")]
33    pub const BooleanAttributeType: Self = Self(800);
34    #[doc(alias = "NSDateAttributeType")]
35    pub const DateAttributeType: Self = Self(900);
36    #[doc(alias = "NSBinaryDataAttributeType")]
37    pub const BinaryDataAttributeType: Self = Self(1000);
38    #[doc(alias = "NSUUIDAttributeType")]
39    pub const UUIDAttributeType: Self = Self(1100);
40    #[doc(alias = "NSURIAttributeType")]
41    pub const URIAttributeType: Self = Self(1200);
42    #[doc(alias = "NSTransformableAttributeType")]
43    pub const TransformableAttributeType: Self = Self(1800);
44    #[doc(alias = "NSObjectIDAttributeType")]
45    pub const ObjectIDAttributeType: Self = Self(2000);
46    #[doc(alias = "NSCompositeAttributeType")]
47    pub const CompositeAttributeType: Self = Self(2100);
48}
49
50unsafe impl Encode for NSAttributeType {
51    const ENCODING: Encoding = NSUInteger::ENCODING;
52}
53
54unsafe impl RefEncode for NSAttributeType {
55    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
56}
57
58extern_class!(
59    /// [Apple's documentation](https://developer.apple.com/documentation/coredata/nsattributedescription?language=objc)
60    #[unsafe(super(NSPropertyDescription, NSObject))]
61    #[derive(Debug, PartialEq, Eq, Hash)]
62    #[cfg(feature = "NSPropertyDescription")]
63    pub struct NSAttributeDescription;
64);
65
66#[cfg(feature = "NSPropertyDescription")]
67extern_conformance!(
68    unsafe impl NSCoding for NSAttributeDescription {}
69);
70
71#[cfg(feature = "NSPropertyDescription")]
72extern_conformance!(
73    unsafe impl NSCopying for NSAttributeDescription {}
74);
75
76#[cfg(feature = "NSPropertyDescription")]
77unsafe impl CopyingHelper for NSAttributeDescription {
78    type Result = Self;
79}
80
81#[cfg(feature = "NSPropertyDescription")]
82extern_conformance!(
83    unsafe impl NSObjectProtocol for NSAttributeDescription {}
84);
85
86#[cfg(feature = "NSPropertyDescription")]
87impl NSAttributeDescription {
88    extern_methods!(
89        #[unsafe(method(attributeType))]
90        #[unsafe(method_family = none)]
91        pub unsafe fn attributeType(&self) -> NSAttributeType;
92
93        /// Setter for [`attributeType`][Self::attributeType].
94        #[unsafe(method(setAttributeType:))]
95        #[unsafe(method_family = none)]
96        pub unsafe fn setAttributeType(&self, attribute_type: NSAttributeType);
97
98        #[unsafe(method(attributeValueClassName))]
99        #[unsafe(method_family = none)]
100        pub unsafe fn attributeValueClassName(&self) -> Option<Retained<NSString>>;
101
102        /// Setter for [`attributeValueClassName`][Self::attributeValueClassName].
103        ///
104        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
105        #[unsafe(method(setAttributeValueClassName:))]
106        #[unsafe(method_family = none)]
107        pub unsafe fn setAttributeValueClassName(
108            &self,
109            attribute_value_class_name: Option<&NSString>,
110        );
111
112        #[unsafe(method(defaultValue))]
113        #[unsafe(method_family = none)]
114        pub unsafe fn defaultValue(&self) -> Option<Retained<AnyObject>>;
115
116        /// Setter for [`defaultValue`][Self::defaultValue].
117        ///
118        /// # Safety
119        ///
120        /// `default_value` should be of the correct type.
121        #[unsafe(method(setDefaultValue:))]
122        #[unsafe(method_family = none)]
123        pub unsafe fn setDefaultValue(&self, default_value: Option<&AnyObject>);
124
125        #[unsafe(method(versionHash))]
126        #[unsafe(method_family = none)]
127        pub unsafe fn versionHash(&self) -> Retained<NSData>;
128
129        #[unsafe(method(valueTransformerName))]
130        #[unsafe(method_family = none)]
131        pub unsafe fn valueTransformerName(&self) -> Option<Retained<NSString>>;
132
133        /// Setter for [`valueTransformerName`][Self::valueTransformerName].
134        ///
135        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
136        #[unsafe(method(setValueTransformerName:))]
137        #[unsafe(method_family = none)]
138        pub unsafe fn setValueTransformerName(&self, value_transformer_name: Option<&NSString>);
139
140        #[unsafe(method(allowsExternalBinaryDataStorage))]
141        #[unsafe(method_family = none)]
142        pub unsafe fn allowsExternalBinaryDataStorage(&self) -> bool;
143
144        /// Setter for [`allowsExternalBinaryDataStorage`][Self::allowsExternalBinaryDataStorage].
145        #[unsafe(method(setAllowsExternalBinaryDataStorage:))]
146        #[unsafe(method_family = none)]
147        pub unsafe fn setAllowsExternalBinaryDataStorage(
148            &self,
149            allows_external_binary_data_storage: bool,
150        );
151
152        #[unsafe(method(preservesValueInHistoryOnDeletion))]
153        #[unsafe(method_family = none)]
154        pub unsafe fn preservesValueInHistoryOnDeletion(&self) -> bool;
155
156        /// Setter for [`preservesValueInHistoryOnDeletion`][Self::preservesValueInHistoryOnDeletion].
157        #[unsafe(method(setPreservesValueInHistoryOnDeletion:))]
158        #[unsafe(method_family = none)]
159        pub unsafe fn setPreservesValueInHistoryOnDeletion(
160            &self,
161            preserves_value_in_history_on_deletion: bool,
162        );
163
164        #[unsafe(method(allowsCloudEncryption))]
165        #[unsafe(method_family = none)]
166        pub unsafe fn allowsCloudEncryption(&self) -> bool;
167
168        /// Setter for [`allowsCloudEncryption`][Self::allowsCloudEncryption].
169        #[unsafe(method(setAllowsCloudEncryption:))]
170        #[unsafe(method_family = none)]
171        pub unsafe fn setAllowsCloudEncryption(&self, allows_cloud_encryption: bool);
172    );
173}
174
175/// Methods declared on superclass `NSObject`.
176#[cfg(feature = "NSPropertyDescription")]
177impl NSAttributeDescription {
178    extern_methods!(
179        #[unsafe(method(init))]
180        #[unsafe(method_family = init)]
181        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
182
183        #[unsafe(method(new))]
184        #[unsafe(method_family = new)]
185        pub unsafe fn new() -> Retained<Self>;
186    );
187}