Skip to main content

rust_macios/foundation/
type_defs.rs

1/* Basic Types
2*/
3
4use libc::c_double;
5
6use crate::{
7    core_graphics::{CGPoint, CGRect, CGSize},
8    objective_c_runtime::id,
9};
10
11use super::{NSComparisonResult, NSDecimalNumber, NSRange, NSString};
12
13/// Describes an integer.
14#[cfg(target_pointer_width = "32")]
15pub type Int = libc::c_int;
16
17/// Describes an unsigned integer.
18#[cfg(target_pointer_width = "32")]
19pub type UInt = libc::c_uint;
20
21/// Describes an integer.
22#[cfg(target_pointer_width = "64")]
23pub type Int = libc::c_long;
24
25/// Describes an unsigned integer.
26#[cfg(target_pointer_width = "64")]
27pub type UInt = libc::c_ulong;
28
29/// Describes an 8-bit signed integer.
30pub type Int8 = libc::c_schar;
31
32/// Describes an 8-bit unsigned integer.
33pub type UInt8 = libc::c_uchar;
34
35/// Describes a 16-bit signed integer.
36pub type Int16 = libc::c_short;
37
38/// Describes a 16-bit unsigned integer.
39pub type UInt16 = libc::c_ushort;
40
41/// Describes a 32-bit signed integer.
42pub type Int32 = libc::c_int;
43
44/// Describes a 32-bit unsigned integer.
45pub type UInt32 = libc::c_uint;
46
47/// Describes a 64-bit signed integer.
48pub type Int64 = libc::c_longlong;
49
50/// Describes a 64-bit unsigned integer.
51pub type UInt64 = libc::c_ulonglong;
52
53/// A double-precision, floating-point value type.
54pub type Double = c_double;
55
56/// Type alias for `NSDecimalNumber`.
57pub type NSDecimal = NSDecimalNumber;
58
59/// A rectangle.
60pub type NSRect = CGRect;
61
62/// A two-dimensional size.
63pub type NSSize = CGSize;
64
65/* Strings and Text
66*/
67
68/// Constants representing an ICU string transform.
69pub type NSStringTransform = *const NSString;
70/// The keys used to access components of a locale.
71pub type NSLocaleKey = *mut NSString;
72
73/// These constants specify mutability options in property lists.
74pub type NSPropertyListWriteOptions = super::NSPropertyListMutabilityOptions;
75
76/// The only read options supported are described in NSPropertyListMutabilityOptions.
77pub type NSPropertyListReadOptions = super::NSPropertyListMutabilityOptions;
78
79/* Dates and Times
80*/
81
82/// A number of seconds.
83pub type NSTimeInterval = c_double;
84
85/// A point in a Cartesian coordinate system.
86pub type NSPoint = CGPoint;
87
88/// A structure that defines the name of a notification.
89pub type NSNotificationName = NSString;
90
91///
92pub type NSErrorDomain = NSString;
93
94/// These keys may exist in the user info dictionary.
95pub type NSErrorUserInfoKey = NSString;
96
97/// Attributes that you can apply to text in an attributed string.
98pub type NSAttributedStringKey = NSString;
99
100/// Type indicating a parameter is a pointer to an NSRange structure.
101pub type NSRangePointer = *mut NSRange;
102
103/// Options for importing documents.
104pub type NSAttributedStringDocumentReadingOptionKey = NSString;
105
106/// Attributes that apply to a document.
107pub type NSAttributedStringDocumentAttributeKey = NSString;
108
109/// Defines the signature for a block object used for comparison operations.
110pub type NSComparator = fn(a: id, b: id) -> NSComparisonResult;