rust_macios/foundation/
enums.rs

1//! Enums for the Foundation library.
2use crate::core_graphics::CGRectEdge;
3
4/// Enums for String Encoding
5pub mod string {
6    /// The following constants are provided by NSString as possible string encodings.
7    #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
8    #[repr(u64)]
9    pub enum Encoding {
10        /// Strict 7-bit ASCII encoding within 8-bit chars; ASCII values 0…127 only.
11        ASCII = 1,
12        /// 8-bit ASCII encoding with NEXTSTEP extensions.
13        NEXTSTEP = 2,
14        /// 8-bit EUC encoding for Japanese text.
15        JapaneseEUC = 3,
16        /// An 8-bit representation of Unicode characters, suitable for transmission or storage by ASCII-based systems.
17        UTF8 = 4,
18        /// 8-bit ISO Latin 1 encoding.
19        ISOLatin1 = 5,
20        /// 8-bit Adobe Symbol encoding vector.
21        Symbol = 6,
22        /// 7-bit verbose ASCII to represent all Unicode characters.
23        NonLossyASCII = 7,
24        /// 8-bit Shift-JIS encoding for Japanese text.
25        ShiftJIS = 8,
26        /// 8-bit ISO Latin 2 encoding.
27        ISOLatin2 = 9,
28        /// The canonical Unicode encoding for string objects.
29        Unicode = 10,
30        /// Microsoft Windows codepage 1251, encoding Cyrillic characters; equivalent to AdobeStandardCyrillic font encoding.
31        WindowsCP1251 = 11,
32        /// Microsoft Windows codepage 1252; equivalent to WinLatin1.
33        WindowsCP1252 = 12,
34        /// Microsoft Windows codepage 1253, encoding Greek characters.
35        WindowsCP1253 = 13,
36        /// Microsoft Windows codepage 1254, encoding Turkish characters.
37        WindowsCP1254 = 14,
38        /// Microsoft Windows codepage 1250; equivalent to WinLatin2.
39        WindowsCP1250 = 15,
40        /// ISO 2022 Japanese encoding for email.
41        ISO2022JP = 21,
42        /// Classic Macintosh Roman encoding.
43        MacOSRoman = 30,
44        /// UTF16 encoding with explicit endianness specified.
45        UTF16BigEndian = 0x90000100,
46        /// UTF16 encoding with explicit endianness specified.
47        UTF16LittleEndian = 0x94000100,
48        /// 32-bit UTF encoding.
49        UTF32 = 0x8c000100,
50        /// UTF32 encoding with explicit endianness specified.
51        UTF32BigEndian = 0x98000100,
52        /// UTF32 encoding with explicit endianness specified.
53        UTF32LittleEndian = 0x9c000100,
54        /// Installation-specific encoding.
55        #[deprecated(note = "This encoding has been deprecated—there is no replacement.")]
56        Proprietary = 65536,
57    }
58
59    impl Encoding {
60        /// An alias for Unicode.
61        pub const UTF16: Self = Encoding::Unicode;
62    }
63}
64
65/// These values represent the options available to many of the string classes’ search and comparison methods.
66#[derive(Debug, PartialEq, Eq)]
67#[repr(u64)]
68pub enum NSStringCompareOptions {
69    /// A case-insensitive search.
70    CaseInsensitive = 1,
71    /// Exact character-by-character equivalence.
72    Literal = 2,
73    /// Search from end of source string.
74    Backwards = 4,
75    /// Search is limited to start (or end, if NSBackwardsSearch) of source string.
76    Anchored = 8,
77    /// Numbers within strings are compared using numeric value, that is, Name2.txt < Name7.txt < Name25.txt.
78    Numeric = 64,
79    /// Search ignores diacritic marks.
80    DiacriticInsensitive = 128,
81    /// Search ignores width differences in characters that have full-width and half-width forms, as occurs in East Asian character sets.
82    WidthInsensitive = 256,
83    /// Comparisons are forced to return either NSOrderedAscending or NSOrderedDescending if the strings are equivalent but not strictly equal.
84    ForcedOrdering = 512,
85    /// The search string is treated as an ICU-compatible regular expression. If set, no other options can apply except caseInsensitive and anchored. You can use this option only with the rangeOfString:… methods and replacingOccurrences(of:with:options:range:).
86    RegularExpression = 1024,
87}
88
89impl NSStringCompareOptions {
90    /// Creates a new `CompareOptions` with the given flags.
91    pub fn new(raw_value: usize) -> Self {
92        match raw_value {
93            1 => NSStringCompareOptions::CaseInsensitive,
94            2 => NSStringCompareOptions::Literal,
95            4 => NSStringCompareOptions::Backwards,
96            8 => NSStringCompareOptions::Anchored,
97            64 => NSStringCompareOptions::Numeric,
98            128 => NSStringCompareOptions::DiacriticInsensitive,
99            256 => NSStringCompareOptions::WidthInsensitive,
100            512 => NSStringCompareOptions::ForcedOrdering,
101            1024 => NSStringCompareOptions::RegularExpression,
102            _ => panic!("Unknown CompareOptions value: {raw_value}"),
103        }
104    }
105}
106
107/// Constants that indicate sort order.
108#[derive(Debug, PartialEq, Eq)]
109#[repr(C)]
110pub enum NSComparisonResult {
111    /// The left operand is smaller than the right operand.
112    OrderedAscending = -1,
113    /// The two operands are equal.
114    OrderedSame = 0,
115    /// The left operand is greater than the right operand.
116    OrderedDescending = 1,
117}
118
119/// The constants used to specify interaction with the cached responses.
120#[derive(Debug)]
121#[repr(u64)]
122pub enum NSUrlRequestCachePolicy {
123    /// Use the caching logic defined in the protocol implementation, if any, for a particular URL load request.
124    UseProtocolCachePolicy = 0,
125    /// The URL load should be loaded only from the originating source.
126    ReloadIgnoringLocalCacheData = 1,
127    /// Ignore local cache data, and instruct proxies and other intermediates to disregard their caches so far as the protocol allows.
128    ReloadIgnoringLocalAndRemoteCacheData = 4, // Unimplemented
129    /// Use existing cache data, regardless or age or expiration date, loading from originating source only if there is no cached data.
130    ReturnCacheDataElseLoad = 2,
131    /// Use existing cache data, regardless or age or expiration date, and fail if no cached data is available.
132    ReturnCacheDataDontLoad = 3,
133    /// Use cache data if the origin source can validate it; otherwise, load from the origin.
134    ReloadRevalidatingCacheData = 5, // Unimplemented
135}
136
137impl NSUrlRequestCachePolicy {
138    /// Replaced by NSURLRequestReloadIgnoringLocalCacheData.
139    #[allow(non_upper_case_globals)]
140    pub const ReloadIgnoringCacheData: Self = Self::ReloadIgnoringLocalCacheData;
141}
142
143/// The type declared for the constants listed in [Stream Status Constants](https://developer.apple.com/documentation/foundation/nsstream/stream_status_constants).
144#[derive(Debug)]
145#[repr(u64)]
146pub enum NSStreamStatus {
147    /// The stream is not open for reading or writing. This status is returned before the
148    /// underlying call to open a stream but after it’s been created.
149    NotOpen = 0,
150    /// The stream is in the process of being opened for reading or for writing. For network streams, this status might include the time after the stream was opened, but while network DNS resolution is happening.
151    Opening = 1,
152    /// The stream is open, but no reading or writing is occurring.
153    Open = 2,
154    /// Data is being read from the stream. This status would be returned if code on another thread were to call streamStatus on the stream while a read:maxLength: call (NSInputStream) was in progress.
155    Reading = 3,
156    /// Data is being written to the stream. This status would be returned if code on another thread were to call streamStatus on the stream while a write:maxLength: call (NSOutputStream) was in progress.
157    Writing = 4,
158    /// There is no more data to read, or no more data can be written to the stream. When this status is returned, the stream is in a “non-blocking” mode and no data are available.
159    AtEnd = 5,
160    /// The stream is closed (close has been called on it).
161    Closed = 6,
162    /// The remote end of the connection can’t be contacted, or the connection has been severed for some other reason.
163    Error = 7,
164}
165
166/// These constants are used to specify a property list serialization format.
167#[derive(Debug)]
168#[repr(u64)]
169pub enum NSPropertyListFormat {
170    /// Specifies the ASCII property list format inherited from the OpenStep APIs.
171    OpenStep = 1,
172    /// Specifies the XML property list format.
173    Xml = 100,
174    /// Specifies the binary property list format.``
175    Binary = 200,
176}
177
178/// These constants specify mutability options in property lists.
179#[derive(Debug)]
180#[repr(u64)]
181pub enum NSPropertyListMutabilityOptions {
182    /// Causes the returned property list to contain immutable objects.
183    Immutable = 0,
184    /// Causes the returned property list to have mutable containers but immutable leaves.
185    MutableContainers = 1,
186    /// Causes the returned property list to have mutable containers and leaves.
187    MutableContainersAndLeaves = 2,
188}
189
190/// These constants specify options for a network service.
191#[derive(Debug)]
192#[repr(u64)]
193pub enum NSNetServiceOptions {
194    /// Specifies that the network service should not rename itself in the event of a name collision.
195    NoAutoRename = 1 << 0,
196    /// Specifies that a TCP listener should be started for both IPv4 and IPv6
197    /// on the port specified by this service. If the listening port can't be
198    /// opened, the service calls its delegate’s netService:didNotPublish:
199    /// method to report the error.
200    ListenForConnections = 1 << 1,
201}
202
203#[derive(Debug)]
204#[repr(u64)]
205pub enum NSDateFormatterStyle {
206    /// Specifies no style.
207    None,
208    /// Specifies a short style, typically numeric only, such as “11/23/37” or “3:30 PM”.
209    Short,
210    /// Specifies a medium style, typically with abbreviated text, such as “Nov 23, 1937” or “3:30:32 PM”.
211    Medium,
212    /// Specifies a long style, typically with full text, such as “November 23, 1937” or “3:30:32 PM PST”.
213    Long,
214    /// Specifies a full style with complete details, such as “Tuesday, April 12, 1952 AD” or “3:30:42 PM Pacific Standard Time”.
215    Full,
216}
217
218/// Constants that specify the behavior NSDateFormatter should exhibit.
219#[derive(Debug)]
220#[repr(u64)]
221pub enum NSDateFormatterBehavior {
222    /// Specifies default formatting behavior.
223    Default = 0,
224    /// Specifies formatting behavior equivalent to that in OS X 10.0.
225    #[cfg(target_os = "macos")]
226    #[allow(non_camel_case_types)]
227    Mode_10_0 = 1000,
228    /// Specifies formatting behavior equivalent for OS X 10.4.
229    #[allow(non_camel_case_types)]
230    Mode_10_4 = 1040,
231}
232
233#[derive(Debug)]
234#[repr(u64)]
235pub enum NSHttpCookieAcceptPolicy {
236    Always,
237    Never,
238    OnlyFromMainDocumentDomain,
239}
240
241#[derive(Debug)]
242#[repr(u64)]
243pub enum NSCalendarUnit {
244    Era = 2,
245    Year = 4,
246    Month = 8,
247    Day = 16,
248    Hour = 32,
249    Minute = 64,
250    Second = 128,
251    #[deprecated]
252    Week = 256,
253    Weekday = 512,
254    WeekdayOrdinal = 1024,
255    Quarter = 2048,
256
257    WeekOfMonth = (1 << 12),
258    WeekOfYear = (1 << 13),
259    YearForWeakOfYear = (1 << 14),
260
261    Nanosecond = (1 << 15),
262
263    Calendar = (1 << 20),
264    TimeZone = (1 << 21),
265}
266
267#[derive(Debug)]
268#[repr(i64)]
269pub enum NSOperationQueuePriority {
270    VeryLow = -8,
271    Low = -4,
272    Normal = 0,
273    High = 4,
274    VeryHigh = 8,
275}
276
277#[derive(Debug)]
278#[repr(u64)]
279pub enum NSNotificationCoalescing {
280    NoCoalescing = 0,
281    CoalescingOnName = 1,
282    CoalescingOnSender = 2,
283}
284
285#[derive(Debug)]
286#[repr(u64)]
287pub enum NSPostingStyle {
288    PostWhenIdle = 1,
289    PostASAP = 2,
290    Now = 3,
291}
292
293#[derive(Debug)]
294#[repr(u64)]
295pub enum NSExpressionType {
296    ConstantValue = 0,
297    EvaluatedObject,
298    Variable,
299    KeyPath,
300    Function,
301    UnionSet,
302    IntersectSet,
303    MinusSet,
304    Subquery = 13,
305    NSAggregate,
306    AnyKey = 15,
307    Block = 19,
308    Conditional = 20,
309}
310
311#[derive(Debug)]
312#[repr(C)]
313pub enum NSUrlError {
314    Unknown = -1,
315
316    BackgroundSessionRequiresSharedContainer = -995,
317    BackgroundSessionInUseByAnotherProcess = -996,
318    BackgroundSessionWasDisconnected = -997,
319
320    Cancelled = -999,
321    BadURL = -1000,
322    TimedOut = -1001,
323    UnsupportedURL = -1002,
324    CannotFindHost = -1003,
325    CannotConnectToHost = -1004,
326    NetworkConnectionLost = -1005,
327    DNSLookupFailed = -1006,
328    HTTPTooManyRedirects = -1007,
329    ResourceUnavailable = -1008,
330    NotConnectedToInternet = -1009,
331    RedirectToNonExistentLocation = -1010,
332    BadServerResponse = -1011,
333    UserCancelledAuthentication = -1012,
334    UserAuthenticationRequired = -1013,
335    ZeroByteResource = -1014,
336    CannotDecodeRawData = -1015,
337    CannotDecodeContentData = -1016,
338    CannotParseResponse = -1017,
339    InternationalRoamingOff = -1018,
340    CallIsActive = -1019,
341    DataNotAllowed = -1020,
342    RequestBodyStreamExhausted = -1021,
343    AppTransportSecurityRequiresSecureConnection = -1022,
344
345    FileDoesNotExist = -1100,
346    FileIsDirectory = -1101,
347    NoPermissionsToReadFile = -1102,
348    DataLengthExceedsMaximum = -1103,
349    FileOutsideSafeArea = -1104,
350
351    SecureConnectionFailed = -1200,
352    ServerCertificateHasBadDate = -1201,
353    ServerCertificateUntrusted = -1202,
354    ServerCertificateHasUnknownRoot = -1203,
355    ServerCertificateNotYetValid = -1204,
356    ClientCertificateRejected = -1205,
357    ClientCertificateRequired = -1206,
358
359    CannotLoadFromNetwork = -2000,
360
361    // Download and file I/O errors
362    CannotCreateFile = -3000,
363    CannotOpenFile = -3001,
364    CannotCloseFile = -3002,
365    CannotWriteToFile = -3003,
366    CannotRemoveFile = -3004,
367    CannotMoveFile = -3005,
368    DownloadDecodingFailedMidStream = -3006,
369    DownloadDecodingFailedToComplete = -3007,
370}
371
372#[derive(Debug)]
373#[repr(u64)]
374pub enum NSKeyValueObservingOptions {
375    New = 1,
376    Old = 2,
377    OldNew = 3,
378    Initial = 4,
379    Prior = 8,
380}
381
382#[derive(Debug)]
383#[repr(u64)]
384pub enum NSKeyValueChange {
385    Setting = 1,
386    Insertion,
387    Removal,
388    Replacement,
389}
390
391#[derive(Debug)]
392#[repr(u64)]
393pub enum NSKeyValueSetMutationKind {
394    UnionSet = 1,
395    MinusSet,
396    IntersectSet,
397    SetSet,
398}
399
400#[derive(Debug)]
401#[repr(u64)]
402pub enum NSEnumerationOptions {
403    SortConcurrent = 1,
404    Reverse = 2,
405}
406
407#[derive(Debug)]
408#[repr(u64)]
409pub enum NSStreamEvent {
410    None = 0,
411    OpenCompleted = 1 << 0,
412    HasBytesAvailable = 1 << 1,
413    HasSpaceAvailable = 1 << 2,
414    ErrorOccurred = 1 << 3,
415    EndEncountered = 1 << 4,
416}
417
418#[derive(Debug)]
419#[repr(u64)]
420pub enum NSComparisonPredicateModifier {
421    Direct,
422    All,
423    Any,
424}
425
426#[derive(Debug)]
427#[repr(u64)]
428pub enum NSPredicateOperatorType {
429    LessThan,
430    LessThanOrEqualTo,
431    GreaterThan,
432    GreaterThanOrEqualTo,
433    EqualTo,
434    NotEqualTo,
435    Matches,
436    Like,
437    BeginsWith,
438    EndsWith,
439    In,
440    CustomSelector,
441    Contains = 99,
442    Between,
443}
444
445#[derive(Debug)]
446#[repr(u64)]
447pub enum NSComparisonPredicateOptions {
448    None = 0x00,
449    CaseInsensitive = 1 << 0,
450    DiacriticInsensitive = 1 << 1,
451    Normalized = 1 << 2,
452}
453
454#[derive(Debug)]
455#[repr(u64)]
456pub enum NSCompoundPredicateType {
457    Not,
458    And,
459    Or,
460}
461
462#[derive(Debug)]
463#[repr(u64)]
464pub enum NSVolumeEnumerationOptions {
465    None = 0,
466    // skip                  = 1 << 0,
467    SkipHiddenVolumes = 1 << 1,
468    ProduceFileReferenceUrls = 1 << 2,
469}
470
471#[derive(Debug)]
472#[repr(u64)]
473pub enum NSDirectoryEnumerationOptions {
474    None = 0,
475    SkipsSubdirectoryDescendants = 1 << 0,
476    SkipsPackageDescendants = 1 << 1,
477    SkipsHiddenFiles = 1 << 2,
478    IncludesDirectoriesPostOrder = 1 << 3,
479    ProducesRelativePathUrls = 1 << 4,
480}
481
482#[derive(Debug)]
483#[repr(u64)]
484pub enum NSFileManagerItemReplacementOptions {
485    None = 0,
486    UsingNewMetadataOnly = 1 << 0,
487    WithoutDeletingBackupItem = 1 << 1,
488}
489
490#[derive(Debug)]
491#[repr(u64)]
492pub enum NSSearchPathDirectory {
493    ApplicationDirectory = 1,
494    DemoApplicationDirectory,
495    DeveloperApplicationDirectory,
496    AdminApplicationDirectory,
497    LibraryDirectory,
498    DeveloperDirectory,
499    UserDirectory,
500    DocumentationDirectory,
501    DocumentDirectory,
502    CoreServiceDirectory,
503    AutosavedInformationDirectory = 11,
504    DesktopDirectory = 12,
505    CachesDirectory = 13,
506    ApplicationSupportDirectory = 14,
507    DownloadsDirectory = 15,
508    InputMethodsDirectory = 16,
509    MoviesDirectory = 17,
510    MusicDirectory = 18,
511    PicturesDirectory = 19,
512    PrinterDescriptionDirectory = 20,
513    SharedPublicDirectory = 21,
514    PreferencePanesDirectory = 22,
515    #[cfg(target_os = "macos")]
516    ApplicationScriptsDirectory = 23,
517    ItemReplacementDirectory = 99,
518    AllApplicationsDirectory = 100,
519    AllLibrariesDirectory = 101,
520    TrashDirectory = 102,
521}
522
523#[derive(Debug)]
524#[repr(u64)]
525pub enum NSSearchPathDomain {
526    None = 0,
527    User = 1 << 0,
528    Local = 1 << 1,
529    Network = 1 << 2,
530    System = 1 << 3,
531    All = 0x0ffff,
532}
533
534/// These constants specify rounding behaviors.
535#[derive(Debug)]
536#[repr(u64)]
537pub enum NSRoundingMode {
538    /// Round to the closest possible return value; when caught halfway between two positive numbers, round up; when caught between two negative numbers, round down.
539    Plain,
540    /// Round return values down.
541    Down,
542    /// Round return values up.
543    Up,
544    /// Round to the closest possible return value; when halfway between two possibilities, return the possibility whose last digit is even.
545    Bankers,
546}
547
548/// Calculation error constants used to describe an error in exceptionDuringOperation:error:leftOperand:rightOperand:.
549#[derive(Debug)]
550#[repr(u64)]
551pub enum NSCalculationError {
552    /// No error occurred.
553    None,
554    /// The number can’t be represented in 38 significant digits.
555    PrecisionLoss,
556    /// The number is too small to represent.
557    Underflow,
558    /// The number is too large to represent.
559    Overflow,
560    /// The caller tried to divide by 0.
561    DivideByZero,
562}
563
564#[derive(Debug)]
565#[repr(u64)]
566pub enum NSStringDrawingOptions {
567    UsesLineFragmentOrigin = (1 << 0),
568    UsesFontLeading = (1 << 1),
569    DisableScreenFontSubstitution = (1 << 2),
570    UsesDeviceMetrics = (1 << 3),
571    OneShot = (1 << 4),
572    TruncatesLastVisibleLine = (1 << 5),
573}
574
575#[derive(Debug)]
576#[repr(u64)]
577pub enum NSNumberFormatterStyle {
578    /// An integer representation.
579    None = 0,
580    /// A decimal style format.
581    Decimal = 1,
582    /// A currency style format that uses the currency symbol defined by the
583    /// number formatter locale.
584    Currency = 2,
585    /// A percent style format.
586    Percent = 3,
587    /// A scientific style format.
588    Scientific = 4,
589    /// A style format in which numbers are spelled out in the language
590    /// defined by the number formatter locale.
591    SpellOut = 5,
592    /// An ordinal style format.
593    OrdinalStyle = 6,
594    /// A currency style format that uses the ISO 4217 currency code defined
595    /// by the number formatter locale.
596    CurrencyIsoCodeStyle = 8,
597    /// A currency style format that uses the pluralized denomination defined
598    /// by the number formatter locale.
599    CurrencyPluralStyle = 9,
600    /// An accounting currency style format that uses the currency symbol
601    /// defined by the number formatter locale.
602    CurrencyAccountingStyle = 10,
603}
604
605#[derive(Debug)]
606#[repr(u64)]
607pub enum NSNumberFormatterBehavior {
608    /// The number-formatter behavior set as the default for new instances.
609    /// You can set the default formatter behavior with the class method setDefaultFormatterBehavior:.
610    Default = 0,
611    /// The number-formatter behavior as it existed prior to macOS 10.4.
612    #[cfg(target_os = "macos")]
613    #[allow(non_camel_case_types)]
614    Version_10_0 = 1000,
615    /// The number-formatter behavior since macOS 10.4.
616    #[allow(non_camel_case_types)]
617    Version_10_4 = 1040,
618}
619
620/// These constants are used to specify how numbers should be padded. These constants are used by the paddingPosition property.
621#[derive(Debug)]
622#[repr(u64)]
623pub enum NSNumberFormatterPadPosition {
624    /// Specifies that the padding should occur before the prefix.
625    BeforePrefix,
626    /// Specifies that the padding should occur after the prefix.
627    AfterPrefix,
628    /// Specifies that the padding should occur before the suffix.
629    BeforeSuffix,
630    /// Specifies that the padding should occur after the suffix.
631    AfterSuffix,
632}
633
634/// These constants are used to specify how numbers should be rounded. These
635/// constants are used by the roundingMode property.
636
637#[derive(Debug)]
638#[repr(u64)]
639pub enum NSNumberFormatterRoundingMode {
640    /// Round towards positive infinity.
641    Ceiling,
642    /// Round towards negative infinity.
643    Floor,
644    /// Round towards zero.
645    Down,
646    /// Round away from zero.
647    Up,
648    /// Round towards the nearest integer, or towards an even number if equidistant.
649    HalfEven,
650    /// Round towards the nearest integer, or towards zero if equidistant.
651    HalfDown,
652    /// Round towards the nearest integer, or away from zero if equidistant.
653    HalfUp,
654}
655
656#[derive(Debug)]
657#[repr(u64)]
658pub enum NSFileVersionReplacingOptions {
659    ByMoving = 1 << 0,
660}
661
662#[derive(Debug)]
663#[repr(u64)]
664pub enum NSFileVersionAddingOptions {
665    ByMoving = 1 << 0,
666}
667
668#[derive(Debug)]
669#[repr(u64)]
670pub enum NSFileCoordinatorReadingOptions {
671    WithoutChanges = 1,
672    ResolvesSymbolicLink = 1 << 1,
673    #[cfg(any(target_os = "ios", target_os = "macos"))]
674    ImmediatelyAvailableMetadataOnly = 1 << 2,
675    #[cfg(any(target_os = "ios", target_os = "macos"))]
676    ForUploading = 1 << 3,
677}
678
679#[derive(Debug)]
680#[repr(u64)]
681pub enum NSFileCoordinatorWritingOptions {
682    ForDeleting = 1,
683    ForMoving = 2,
684    ForMerging = 4,
685    ForReplacing = 8,
686    #[cfg(any(target_os = "ios", target_os = "macos"))]
687    ContentIndependentMetadataOnly = 16,
688}
689
690#[derive(Debug)]
691#[repr(u64)]
692pub enum NSLinguisticTaggerOptions {
693    OmitWords = 1,
694    OmitPunctuation = 2,
695    OmitWhitespace = 4,
696    OmitOther = 8,
697    JoinNames = 16,
698}
699
700#[derive(Debug)]
701#[repr(i64)]
702pub enum NSUbiquitousKeyValueStoreChangeReason {
703    ServerChange,
704    InitialSyncChange,
705    QuotaViolationChange,
706    AccountChange,
707}
708
709#[derive(Debug)]
710#[repr(u64)]
711pub enum NSJsonReadingOptions {
712    MutableContainers = 1,
713    MutableLeaves = 2,
714    FragmentsAllowed = 4,
715}
716
717#[derive(Debug)]
718#[repr(u64)]
719pub enum NSJsonWritingOptions {
720    PrettyPrinted = 1,
721    SortedKeys = (1 << 1),
722    FragmentsAllowed = (1 << 2),
723    WithoutEscapingSlashes = (1 << 3),
724}
725
726#[derive(Debug)]
727#[repr(u64)]
728pub enum NSLocaleLanguageDirection {
729    Unknown,
730    LeftToRight,
731    RightToLeft,
732    TopToBottom,
733    BottomToTop,
734}
735
736#[derive(Debug)]
737#[repr(i64)]
738pub enum NSAlignmentOptions {
739    MinXInward = 1 << 0,
740    MinYInward = 1 << 1,
741    MaxXInward = 1 << 2,
742    MaxYInward = 1 << 3,
743    WidthInward = 1 << 4,
744    HeightInward = 1 << 5,
745
746    MinXOutward = 1 << 8,
747    MinYOutward = 1 << 9,
748    MaxXOutward = 1 << 10,
749    MaxYOutward = 1 << 11,
750    WidthOutward = 1 << 12,
751    HeightOutward = 1 << 13,
752
753    MinXNearest = 1 << 16,
754    MinYNearest = 1 << 17,
755    MaxXNearest = 1 << 18,
756    MaxYNearest = 1 << 19,
757    WidthNearest = 1 << 20,
758    HeightNearest = 1 << 21,
759
760    RectFlipped = (1_u64 << 63) as i64,
761}
762
763impl NSAlignmentOptions {
764    // pub const AllEdgesInward: Self = Self::MinXInward | Self::MaxXInward | Self::MinYInward | Self:: MaxYInward;
765    // pub const AllEdgesOutward: Self = Self::MinXOutward | Self::MaxXOutward | Self:MinYOutward | Self::MaxYOutward;
766    // pub const AllEdgesNearest: Self = Self::MinXNearest | Self::MaxXNearest | Self::MinYNearest | Self::MaxYNearest,
767}
768
769#[derive(Debug)]
770#[repr(u64)]
771pub enum NSFileWrapperReadingOptions {
772    Immediate = 1 << 0,
773    WithoutMapping = 1 << 1,
774}
775
776#[derive(Debug)]
777#[repr(u64)]
778pub enum NSFileWrapperWritingOptions {
779    Atomic = 1 << 0,
780    WithNameUpdating = 1 << 1,
781}
782
783#[derive(Debug)]
784#[repr(u64)]
785pub enum NSAttributedStringEnumerationOptions {
786    None = 0,
787    Reverse = 1 << 1,
788    LongestEffectiveRangeNotRequired = 1 << 20,
789}
790
791#[derive(Debug)]
792#[repr(i64)]
793pub enum NSWritingDirection {
794    Natural = -1,
795    LeftToRight = 0,
796    RightToLeft = 1,
797}
798
799#[derive(Debug)]
800#[repr(u64)]
801pub enum NSByteCountFormatterUnits {
802    UseDefault = 0,
803    UseBytes = 1 << 0,
804    UseKB = 1 << 1,
805    UseMB = 1 << 2,
806    UseGB = 1 << 3,
807    UseTB = 1 << 4,
808    UsePB = 1 << 5,
809    UseEB = 1 << 6,
810    UseZB = 1 << 7,
811    UseYBOrHigher = 0x0FF << 8,
812    UseAll = 0x0FFFF,
813}
814
815#[derive(Debug)]
816#[repr(i64)]
817pub enum NSByteCountFormatterCountStyle {
818    File,
819    Memory,
820    Decimal,
821    Binary,
822}
823
824#[derive(Debug)]
825#[repr(u64)]
826pub enum NSUrlBookmarkCreationOptions {
827    PreferFileIDResolution = 1 << 8,
828    MinimalBookmark = 1 << 9,
829    SuitableForBookmarkFile = 1 << 10,
830    WithSecurityScope = 1 << 11,
831    SecurityScopeAllowOnlyReadAccess = 1 << 12,
832}
833
834#[derive(Debug)]
835#[repr(u64)]
836pub enum NSUrlBookmarkResolutionOptions {
837    WithoutUI = 1 << 8,
838    WithoutMounting = 1 << 9,
839    WithSecurityScope = 1 << 10,
840}
841
842#[derive(Debug)]
843#[repr(u64)]
844pub enum NSLigatureType {
845    None,
846    Default,
847    All,
848}
849
850#[derive(Debug)]
851#[repr(u64)]
852pub enum NSCalendarOptions {
853    None = 0,
854    WrapCalendarComponents = 1 << 0,
855
856    #[cfg(any(target_os = "ios", target_os = "macos"))]
857    MatchStrictly = 1 << 1,
858    #[cfg(any(target_os = "ios", target_os = "macos"))]
859    SearchBackwards = 1 << 2,
860
861    #[cfg(any(target_os = "ios", target_os = "macos"))]
862    MatchPreviousTimePreservingSmallerUnits = 1 << 8,
863    #[cfg(any(target_os = "ios", target_os = "macos"))]
864    MatchNextTimePreservingSmallerUnits = 1 << 9,
865    #[cfg(any(target_os = "ios", target_os = "macos"))]
866    MatchNextTime = 1 << 10,
867
868    #[cfg(any(target_os = "ios", target_os = "macos"))]
869    MatchFirst = 1 << 12,
870    #[cfg(any(target_os = "ios", target_os = "macos"))]
871    MatchLast = 1 << 13,
872}
873
874#[derive(Debug)]
875#[repr(u64)]
876pub enum NSUrlRequestNetworkServiceType {
877    Default,
878    #[deprecated(note = "Use 'PushKit' framework instead.")]
879    VoIP,
880    Video,
881    Background,
882    Voice,
883    ResponsiveData = 6,
884    AVStreaming = 8,
885    ResponsiveAV = 9,
886    CallSignaling = 11,
887}
888
889#[derive(Debug)]
890#[repr(u64)]
891pub enum NSSortOptions {
892    Concurrent = 1 << 0,
893    Stable = 1 << 4,
894}
895
896#[cfg(target_os = "ios")]
897#[deprecated(note = "Use 'NSWritingDirectionFormatType'.")]
898#[derive(Debug)]
899#[repr(i64)]
900pub enum NSTextWritingDirection {
901    Embedding = 0,
902    Override = 2,
903}
904
905#[derive(Debug)]
906#[repr(i64)]
907pub enum NSUrlSessionAuthChallengeDisposition {
908    UseCredential = 0,
909    PerformDefaultHandling = 1,
910    CancelAuthenticationChallenge = 2,
911    RejectProtectionSpace = 3,
912}
913
914#[derive(Debug)]
915#[repr(i64)]
916pub enum NSUrlSessionTaskState {
917    Running = 0,
918    Suspended = 1,
919    Canceling = 2,
920    Completed = 3,
921}
922
923#[derive(Debug)]
924#[repr(i64)]
925pub enum NSUrlSessionResponseDisposition {
926    Cancel = 0,
927    Allow = 1,
928    BecomeDownload = 2,
929    BecomeStream = 3,
930}
931
932#[derive(Debug)]
933#[repr(i64)]
934pub enum NSUrlErrorCancelledReason {
935    UserForceQuitApplication,
936    BackgroundUpdatesDisabled,
937    InsufficientSystemResources,
938}
939
940#[derive(Debug)]
941#[repr(i64)]
942pub enum NSTimeZoneNameStyle {
943    Standard,
944    ShortStandard,
945    DaylightSaving,
946    ShortDaylightSaving,
947    Generic,
948    ShortGeneric,
949}
950
951#[derive(Debug)]
952#[repr(i64)]
953pub enum NSItemProviderErrorCode {
954    Unknown = -1,
955    None = 0,
956    ItemUnavailable = -1000,
957    UnexpectedValueClass = -1100,
958    UnavailableCoercion = -1200,
959}
960
961#[derive(Debug)]
962#[repr(i64)]
963pub enum NSDateComponentsFormatterUnitsStyle {
964    Positional = 0,
965    Abbreviated,
966    Short,
967    Full,
968    SpellOut,
969    Brief,
970}
971
972/// The formatting context for a formatter.
973#[cfg(any(target_os = "ios", target_os = "macos"))]
974#[derive(Debug)]
975#[repr(i64)]
976pub enum NSFormattingContext {
977    /// An unknown formatting context.
978    Unknown = 0,
979    /// A formatting context determined automatically at runtime.
980    Dynamic = 1,
981    /// The formatting context for stand-alone usage.
982    Standalone = 2,
983    /// The formatting context for a list or menu item.
984    ListItem = 3,
985    /// The formatting context for the beginning of a sentence.
986    BeginningOfSentence = 4,
987    /// The formatting context for the middle of a sentence.
988    MiddleOfSentence = 5,
989}
990
991#[cfg(any(target_os = "ios", target_os = "macos"))]
992#[derive(Debug)]
993#[repr(u64)]
994pub enum NSDateIntervalFormatterStyle {
995    None = 0,
996    Short = 1,
997    Medium = 2,
998    Long = 3,
999    Full = 4,
1000}
1001
1002#[cfg(any(target_os = "ios", target_os = "macos"))]
1003#[derive(Debug)]
1004#[repr(i64)]
1005pub enum NSEnergyFormatterUnit {
1006    Joule = 11,
1007    Kilojoule = 14,
1008    Calorie = (7 << 8) + 1,
1009    Kilocalorie = (7 << 8) + 2,
1010}
1011
1012/// Specifies the width of the unit, determining the textual representation.
1013#[cfg(any(target_os = "ios", target_os = "macos"))]
1014#[derive(Debug)]
1015#[repr(i64)]
1016pub enum NSFormattingUnitStyle {
1017    /// Specifies a short unit style.
1018    Short = 1,
1019    /// Specifies a medium unit style.
1020    Medium,
1021    /// Specifies a long unit style.
1022    Long,
1023}
1024
1025#[cfg(any(target_os = "ios", target_os = "macos"))]
1026#[derive(Debug)]
1027#[repr(i64)]
1028pub enum NSMassFormatterUnit {
1029    Gram = 11,
1030    Kilogram = 14,
1031    Ounce = (6 << 8) + 1,
1032    Pound = (6 << 8) + 2,
1033    Stone = (6 << 8) + 3,
1034}
1035
1036#[cfg(any(target_os = "ios", target_os = "macos"))]
1037#[derive(Debug)]
1038#[repr(i64)]
1039pub enum NSLengthFormatterUnit {
1040    Millimeter = 8,
1041    Centimeter = 9,
1042    Meter = 11,
1043    Kilometer = 14,
1044    Inch = (5 << 8) + 1,
1045    Foot = (5 << 8) + 2,
1046    Yard = (5 << 8) + 3,
1047    Mile = (5 << 8) + 4,
1048}
1049
1050#[cfg(any(target_os = "ios", target_os = "macos"))]
1051#[derive(Debug)]
1052#[repr(i64)]
1053pub enum NSQualityOfService {
1054    UserInteractive = 33,
1055    UserInitiated = 25,
1056    Utility = 17,
1057    Background = 9,
1058    Default = -1,
1059}
1060
1061#[derive(Debug)]
1062#[repr(i64)]
1063pub enum NSUrlRelationship {
1064    Contains,
1065    Same,
1066    Other,
1067}
1068
1069#[derive(Debug)]
1070#[repr(u64)]
1071pub enum NSTextCheckingType {
1072    Orthography = 1 << 0,
1073    Spelling = 1 << 1,
1074    Grammar = 1 << 2,
1075    Date = 1 << 3,
1076    Address = 1 << 4,
1077    Link = 1 << 5,
1078    Quote = 1 << 6,
1079    Dash = 1 << 7,
1080    Replacement = 1 << 8,
1081    Correction = 1 << 9,
1082    RegularExpression = 1 << 10,
1083    PhoneNumber = 1 << 11,
1084    TransitInformation = 1 << 12,
1085}
1086
1087#[derive(Debug)]
1088#[repr(u64)]
1089pub enum NSRegularExpressionOptions {
1090    CaseInsensitive = 1 << 0,
1091    AllowCommentsAndWhitespace = 1 << 1,
1092    IgnoreMetacharacters = 1 << 2,
1093    DotMatchesLineSeparators = 1 << 3,
1094    AnchorsMatchLines = 1 << 4,
1095    UseUnixLineSeparators = 1 << 5,
1096    UseUnicodeWordBoundaries = 1 << 6,
1097}
1098
1099#[derive(Debug)]
1100#[repr(u64)]
1101pub enum NSMatchingOptions {
1102    ReportProgress = 1 << 0,
1103    ReportCompletion = 1 << 1,
1104    Anchored = 1 << 2,
1105    WithTransparentBounds = 1 << 3,
1106    WithoutAnchoringBounds = 1 << 4,
1107}
1108
1109#[derive(Debug)]
1110#[repr(u64)]
1111pub enum NSMatchingFlags {
1112    Progress = 1 << 0,
1113    Completed = 1 << 1,
1114    HitEnd = 1 << 2,
1115    RequiredEnd = 1 << 3,
1116    InternalError = 1 << 4,
1117}
1118
1119#[cfg(any(target_os = "ios", target_os = "macos"))]
1120#[derive(Debug)]
1121#[repr(u64)]
1122pub enum NSPersonNameComponentsFormatterOptions {
1123    Phonetic = (1 << 1),
1124}
1125
1126#[cfg(any(target_os = "ios", target_os = "macos"))]
1127#[derive(Debug)]
1128#[repr(i64)]
1129pub enum NSPersonNameComponentsFormatterStyle {
1130    Default = 0,
1131    Short,
1132    Medium,
1133    Long,
1134    Abbreviated,
1135}
1136
1137#[cfg(any(target_os = "ios", target_os = "macos"))]
1138#[derive(Debug)]
1139#[repr(i64)]
1140pub enum NSDecodingFailurePolicy {
1141    RaiseException,
1142    SetErrorAndReturn,
1143}
1144
1145#[derive(Debug)]
1146#[repr(u64)]
1147pub enum NSIso8601DateFormatOptions {
1148    Year = 1 << 0,
1149    Month = 1 << 1,
1150    WeekOfYear = 1 << 2,
1151    Day = 1 << 4,
1152    Time = 1 << 5,
1153    TimeZone = 1 << 6,
1154    SpaceBetweenDateAndTime = 1 << 7,
1155    DashSeparatorInDate = 1 << 8,
1156    ColonSeparatorInTime = 1 << 9,
1157    ColonSeparatorInTimeZone = 1 << 10,
1158    FractionalSeconds = 1 << 11,
1159    // TODO: BitOR for `NSIso8601DateFormatOptions`
1160
1161    // FullDate = Year | Month | Day | DashSeparatorInDate,
1162    // FullTime = Time | ColonSeparatorInTime | TimeZone | ColonSeparatorInTimeZone,
1163    // InternetDateTime = FullDate | FullTime,
1164}
1165
1166#[derive(Debug)]
1167#[repr(i64)]
1168pub enum NSUrlSessionTaskMetricsResourceFetchType {
1169    Unknown,
1170    NetworkLoad,
1171    ServerPush,
1172    LocalCache,
1173}
1174
1175#[derive(Debug)]
1176#[repr(u64)]
1177pub enum NSMeasurementFormatterUnitOptions {
1178    ProvidedUnit = (1 << 0),
1179    NaturalScale = (1 << 1),
1180    TemperatureWithoutUnit = (1 << 2),
1181}
1182
1183#[derive(Debug)]
1184#[repr(i64)]
1185pub enum NSItemProviderRepresentationVisibility {
1186    All = 0,
1187    Team = 1,
1188    Group = 2,
1189    OwnProcess = 3,
1190}
1191
1192#[derive(Debug)]
1193#[repr(i64)]
1194pub enum NSItemProviderFileOptions {
1195    OpenInPlace = 1,
1196}
1197
1198#[derive(Debug)]
1199#[repr(i64)]
1200pub enum NSLinguisticTaggerUnit {
1201    Word,
1202    Sentence,
1203    Paragraph,
1204    Document,
1205}
1206
1207#[derive(Debug)]
1208#[repr(i64)]
1209pub enum NSUrlSessionDelayedRequestDisposition {
1210    ContinueLoading = 0,
1211    UseNewRequest = 1,
1212    Cancel = 2,
1213}
1214
1215#[derive(Debug)]
1216#[repr(u64)]
1217pub enum NSXpcConnectionOptions {
1218    Privileged = (1 << 12),
1219}
1220
1221#[derive(Debug, Copy, Clone)]
1222#[repr(u64)]
1223pub enum NSStringEncodingConversionOptions {
1224    AllowLossy = 1,
1225    ExternalRepresentation = 2,
1226}
1227
1228///
1229#[derive(Debug)]
1230#[repr(u64)]
1231pub enum NSRectEdge {
1232    ///
1233    MinXEdge,
1234    ///
1235    MinYEdge,
1236    ///
1237    MaxXEdge,
1238    ///
1239    MaxYEdge,
1240}
1241
1242impl NSRectEdge {
1243    ///
1244    #[allow(non_upper_case_globals)]
1245    pub const MaxX: CGRectEdge = CGRectEdge::MaxXEdge;
1246
1247    ///
1248    #[allow(non_upper_case_globals)]
1249    pub const MaxY: CGRectEdge = CGRectEdge::MaxYEdge;
1250
1251    ///
1252    #[allow(non_upper_case_globals)]
1253    pub const MinX: CGRectEdge = CGRectEdge::MinXEdge;
1254
1255    ///
1256    #[allow(non_upper_case_globals)]
1257    pub const MinY: CGRectEdge = CGRectEdge::MinYEdge;
1258}