File: objc_generics.h

package info (click to toggle)
swiftlang 6.0.3-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,519,992 kB
  • sloc: cpp: 9,107,863; ansic: 2,040,022; asm: 1,135,751; python: 296,500; objc: 82,456; f90: 60,502; lisp: 34,951; pascal: 19,946; sh: 18,133; perl: 7,482; ml: 4,937; javascript: 4,117; makefile: 3,840; awk: 3,535; xml: 914; fortran: 619; cs: 573; ruby: 573
file content (122 lines) | stat: -rw-r--r-- 3,078 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
#import <Foundation.h>
#include <stdint.h>

#define _CF_TYPED_ENUM __attribute__((swift_wrapper(enum)))
#define NS_STRING_ENUM _CF_TYPED_ENUM
#define NS_SWIFT_NAME(Name) __attribute__((swift_name(#Name)))

typedef NSString * GenericOption NS_STRING_ENUM;

GenericOption const GenericOptionMultithreaded NS_SWIFT_NAME(multithreaded);


@interface GenericClass<T> : NSObject
- (id)initWithThing:(T)thing;
- (id)initWithArrayOfThings:(NSArray<T> *_Nonnull)things;
- (id)initWithOptions:(nullable NSDictionary<GenericOption, id> *)options;
- (void)dealloc;
- (_Nullable T)thing;
- (int)count;
+ (_Nullable T)classThing;
- (_Nonnull NSArray<T> *)arrayOfThings;
- (void)setArrayOfThings:(NSArray<T> *_Nonnull)things;

- (T _Nonnull)objectAtIndexedSubscript:(uint16_t)i;
- (void)setObject:(T _Nonnull)object atIndexedSubscript:(uint16_t)i;

- (void)performBlockOnThings:(T _Nonnull (^_Nonnull)(T _Nonnull))block;
- (T _Nonnull (^_Nonnull)(T _Nonnull))blockForPerformingOnThings;

@property(nonatomic) _Nullable T propertyThing;
@property(nonatomic) _Nullable NSArray<T> *propertyArrayOfThings;
@end

@interface GenericClass<T>(Private)
- (_Nullable T)otherThing;
+ (_Nullable T)otherClassThing;
@end

void takeGenericClass(_Nullable GenericClass<NSString *> *thing);

@interface GenericSubclass<T> : GenericClass<T>
@end

@protocol Pettable
- (nonnull instancetype)initWithFur:(nonnull id)fur;
- (nonnull instancetype)other;
+ (nonnull instancetype)adopt;
- (void)pet;
- (void)petWith:(nonnull id <Pettable>)other;

@property (nonatomic, class) _Nonnull id<Pettable> needingMostPets;

@end

@interface Animal : NSObject
- (nonnull instancetype)initWithNoise:(nonnull id)noise;
- (nonnull instancetype)another;
+ (nonnull instancetype)create;

- (void)eat:(Animal*)prey;

@property (nonatomic, readonly) Animal *_Nonnull buddy;

@property (nonatomic, class) Animal *_Nonnull apexPredator;

- (Animal *_Nonnull)objectAtIndexedSubscript:(NSInteger)i;
- (void)setObject:(Animal *_Nonnull)x atIndexedSubscript:(NSInteger)i;
@end

@interface PettableOverextendedMetaphor: NSObject <Pettable>
@end

@protocol Fungible
@end

@interface FungibleContainer<T : id<Fungible>> : NSObject
@end

@interface PettableContainer<T : id<Pettable>> : NSObject
@end

@interface AnimalContainer<T : Animal *> : NSObject
@end

@interface PettableAnimalContainer<T : Animal<Pettable> *> : NSObject
@end

@interface FungibleAnimalContainer<T : Animal<Fungible> *> : NSObject
@end

@interface TestConstrainedTypeParam<T> : NSObject
- (void)doThing:(_Nonnull T<Pettable>)thing;
@end

typedef id <Fungible> FungibleObject;

@interface Panda

// Unqualified reference to generic type

+ (AnimalContainer *)getContainer;
+ (FungibleAnimalContainer *)getFungibleContainer;

@end

@interface First<__covariant T> : NSObject
@end

@interface Second<__covariant T> : First<T>
@end

@class Third;

@interface Third : Second<Third *>
@end

typedef void (^ _Nonnull BlockPointerType)(void);

@interface HasBlockArray : NSObject
- (NSArray<BlockPointerType> * _Nonnull)blockArray;
- (BlockPointerType)blockPointerType;
@end