|
1 |
| -// Enum usage that is bitwise-able and assignable in C++, aka how CF_OPTIONS |
2 |
| -// does things. |
3 |
| -typedef int __attribute__((availability(swift, unavailable))) NSEnumerationOptions; |
4 |
| -enum : NSEnumerationOptions { NSEnumerationConcurrent, NSEnumerationReverse }; |
| 1 | +typedef unsigned NSUInteger; |
| 2 | + |
| 3 | +#define __CF_OPTIONS_ATTRIBUTES __attribute__((flag_enum,enum_extensibility(open))) |
| 4 | +#if (__cplusplus) |
| 5 | +#define CF_OPTIONS(_type, _name) __attribute__((availability(swift,unavailable))) _type _name; enum __CF_OPTIONS_ATTRIBUTES : _name |
| 6 | +#else |
| 7 | +#define CF_OPTIONS(_type, _name) enum __CF_OPTIONS_ATTRIBUTES _name : _type _name; enum _name : _type |
| 8 | +#endif |
| 9 | + |
| 10 | +typedef CF_OPTIONS(NSUInteger, NSEnumerationOptions) { |
| 11 | + NSEnumerationConcurrent = (1UL << 0), |
| 12 | + NSEnumerationReverse = (1UL << 1), |
| 13 | +}; |
5 | 14 |
|
6 | 15 | @interface NSSet
|
7 | 16 | - (void)enumerateObjectsWithOptions:(NSEnumerationOptions)opts ;
|
8 | 17 | @end
|
9 | 18 |
|
10 |
| -typedef int __attribute__((availability(swift, unavailable))) NSOrderedCollectionDifferenceCalculationOptions; |
11 |
| -enum : NSOrderedCollectionDifferenceCalculationOptions { |
| 19 | +typedef CF_OPTIONS(NSUInteger, NSOrderedCollectionDifferenceCalculationOptions) { |
12 | 20 | NSOrderedCollectionDifferenceCalculationOptions1,
|
13 | 21 | NSOrderedCollectionDifferenceCalculationOptions2
|
14 | 22 | };
|
15 | 23 |
|
16 |
| -typedef int __attribute__((availability(swift, unavailable))) NSCalendarUnit; |
17 |
| -enum : NSCalendarUnit { NSCalendarUnit1, NSCalendarUnit2 }; |
| 24 | +typedef CF_OPTIONS(NSUInteger, NSCalendarUnit) { |
| 25 | + NSCalendarUnit1, |
| 26 | + NSCalendarUnit2 |
| 27 | +}; |
18 | 28 |
|
19 |
| -typedef int __attribute__((availability(swift, unavailable))) NSSearchPathDomainMask; |
20 |
| -enum : NSSearchPathDomainMask { NSSearchPathDomainMask1, NSSearchPathDomainMask2 }; |
| 29 | +typedef CF_OPTIONS(NSUInteger, NSSearchPathDomainMask) { |
| 30 | + NSSearchPathDomainMask1, |
| 31 | + NSSearchPathDomainMask2 |
| 32 | +}; |
21 | 33 |
|
22 |
| -typedef int __attribute__((availability(swift, unavailable))) NSControlCharacterAction; |
23 |
| -enum : NSControlCharacterAction { NSControlCharacterAction1, NSControlCharacterAction2 }; |
| 34 | +typedef CF_OPTIONS(NSUInteger, NSControlCharacterAction) { |
| 35 | + NSControlCharacterAction1, |
| 36 | + NSControlCharacterAction2 |
| 37 | +}; |
24 | 38 |
|
25 |
| -typedef int __attribute__((availability(swift, unavailable))) UIControlState; |
26 |
| -enum : UIControlState { UIControlState1, UIControlState2 }; |
| 39 | +typedef CF_OPTIONS(NSUInteger, UIControlState) { |
| 40 | + UIControlState1, |
| 41 | + UIControlState2 |
| 42 | +}; |
27 | 43 |
|
28 |
| -typedef int __attribute__((availability(swift, unavailable))) UITableViewCellStateMask; |
29 |
| -enum : UITableViewCellStateMask { UITableViewCellStateMask1, UITableViewCellStateMask2 }; |
| 44 | +typedef CF_OPTIONS(NSUInteger, UITableViewCellStateMask) { |
| 45 | + UITableViewCellStateMask1, |
| 46 | + UITableViewCellStateMask2 |
| 47 | +}; |
30 | 48 |
|
31 |
| -typedef int __attribute__((availability(swift, unavailable))) UIControlEvents; |
32 |
| -enum : UIControlEvents { UIControlEvents1, UIControlEvents2 }; |
| 49 | +typedef CF_OPTIONS(NSUInteger, UIControlEvents) { |
| 50 | + UIControlEvents1, |
| 51 | + UIControlEvents2 |
| 52 | +}; |
33 | 53 |
|
34 |
| -typedef int __attribute__((availability(swift, unavailable))) |
35 |
| -UITableViewScrollPosition; |
36 |
| -enum : UITableViewScrollPosition { |
| 54 | +typedef CF_OPTIONS(NSUInteger, UITableViewScrollPosition) { |
37 | 55 | UITableViewScrollPosition1,
|
38 | 56 | UITableViewScrollPosition2
|
39 | 57 | };
|
|
0 commit comments