ObjFW  Diff

Differences From Artifact [a1ab03cb5a]:

To Artifact [8884ec4c85]:


130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
 * @note This is a legacy from before C had a boolean type. Prefer the standard
 *	 C99 bool instead!
 */
typedef bool BOOL;
#endif

/**
 * @brief A method implemenation.
 *
 * @param object The messaged object
 * @param selector The selector sent
 */
typedef id _Nullable (*IMP)(id _Nonnull object, SEL _Nonnull selector, ...);

/**







|







130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
 * @note This is a legacy from before C had a boolean type. Prefer the standard
 *	 C99 bool instead!
 */
typedef bool BOOL;
#endif

/**
 * @brief A method implementation.
 *
 * @param object The messaged object
 * @param selector The selector sent
 */
typedef id _Nullable (*IMP)(id _Nonnull object, SEL _Nonnull selector, ...);

/**
169
170
171
172
173
174
175
















176
177
178
179
180
181
182
#ifdef __cplusplus
	Class _Nonnull class_;
#else
	Class _Nonnull class;
#endif
};

















#ifdef __cplusplus
extern "C" {
#endif

/**
 * @brief Registers a selector with the specified name with the runtime.
 *







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
#ifdef __cplusplus
	Class _Nonnull class_;
#else
	Class _Nonnull class;
#endif
};

/**
 * @brief A policy for object association, see @ref objc_setAssociatedObject.
 */
typedef enum objc_associationPolicy {
	/** @brief Associate the object like an assigned property. */
	OBJC_ASSOCIATION_ASSIGN	= 0,
	/** @brief Associate the object like a retained, nonatomic property. */
	OBJC_ASSOCIATION_RETAIN_NONATOMIC = 1,
	/** @brief Associate the object like a retained property. */
	OBJC_ASSOCIATION_RETAIN = OBJC_ASSOCIATION_RETAIN_NONATOMIC | 0x300,
	/** @brief Associate the object like a copied, nonatomic property. */
	OBJC_ASSOCIATION_COPY_NONATOMIC = 3,
	/** @brief Associate the object like a copied property. */
	OBJC_ASSOCIATION_COPY = OBJC_ASSOCIATION_COPY_NONATOMIC | 0x300
} objc_associationPolicy;

#ifdef __cplusplus
extern "C" {
#endif

/**
 * @brief Registers a selector with the specified name with the runtime.
 *
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
 * @warning If the method uses the struct return ABI, you need to use
 *	    @ref class_getMethodImplementation_stret instead! Depending on the
 *	    ABI, small structs might not use the struct return ABI.
 *
 * @param class_ The class whose method implementation should be returned
 * @param selector The selector for the method whose implementation should be
 *		   returned
 * @return The class's metod implementation for the specified selector
 */
extern IMP _Nullable class_getMethodImplementation(Class _Nullable class_,
    SEL _Nonnull selector);

/**
 * @brief Returns the class's method implementation for the specified selector.
 *
 * @warning If the method does not use use the struct return ABI, you need to
 *	    use @ref class_getMethodImplementation instead! Depending on the
 *	    ABI, small structs might not use the struct return ABI.
 *
 * @param class_ The class whose method implementation should be returned
 * @param selector The selector for the method whose implementation should be
 *		   returned
 * @return The class's metod implementation for the specified selector
 */
extern IMP _Nullable class_getMethodImplementation_stret(Class _Nullable class_,
    SEL _Nonnull selector);

/**
 * @brief Returns the class's instance method for the specified selector
 *







|














|







324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
 * @warning If the method uses the struct return ABI, you need to use
 *	    @ref class_getMethodImplementation_stret instead! Depending on the
 *	    ABI, small structs might not use the struct return ABI.
 *
 * @param class_ The class whose method implementation should be returned
 * @param selector The selector for the method whose implementation should be
 *		   returned
 * @return The class's method implementation for the specified selector
 */
extern IMP _Nullable class_getMethodImplementation(Class _Nullable class_,
    SEL _Nonnull selector);

/**
 * @brief Returns the class's method implementation for the specified selector.
 *
 * @warning If the method does not use use the struct return ABI, you need to
 *	    use @ref class_getMethodImplementation instead! Depending on the
 *	    ABI, small structs might not use the struct return ABI.
 *
 * @param class_ The class whose method implementation should be returned
 * @param selector The selector for the method whose implementation should be
 *		   returned
 * @return The class's method implementation for the specified selector
 */
extern IMP _Nullable class_getMethodImplementation_stret(Class _Nullable class_,
    SEL _Nonnull selector);

/**
 * @brief Returns the class's instance method for the specified selector
 *
642
643
644
645
646
647
648































649
650
651
652
653
654
655
 *
 * @param class_ The tag ID for the tagged pointer class to use
 * @param value The value the tagged pointer should have
 * @return A tagged pointer, or `nil` if it could not be created
 */
extern id _Nullable objc_createTaggedPointer(int class_, uintptr_t value);
































/*
 * Used by the compiler, but can also be called manually.
 *
 * These declarations are also required to prevent Clang's implicit
 * declarations which include __declspec(dllimport) on Windows.
 */
struct objc_module;







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
 *
 * @param class_ The tag ID for the tagged pointer class to use
 * @param value The value the tagged pointer should have
 * @return A tagged pointer, or `nil` if it could not be created
 */
extern id _Nullable objc_createTaggedPointer(int class_, uintptr_t value);

/**
 * @brief Sets an associated object on the specified object for the specified
 *	  key.
 *
 * @param object The object on which to set an associated object
 * @param key A unique pointer to use as the key for the association
 * @param value The object to associate with the specified object
 * @param policy The association policy, see @ref objc_associationPolicy
 */
extern void objc_setAssociatedObject(id _Nonnull object,
    const void *_Nonnull key, id _Nullable value,
    objc_associationPolicy policy);

/**
 * @brief Returns the associated object on the specified object for the
 *	  specified key.
 *
 * @param object The object on which to get the associated object
 * @param key The key of the association
 * @return The associated object on the specified object for the specified key
 */
extern id _Nullable objc_getAssociatedObject(id _Nonnull object,
    const void *_Nonnull key);

/**
 * @brief Removes all associated objects for the specified object.
 *
 * @param object The object on which to remove all associated objects
 */
extern void objc_removeAssociatedObjects(id _Nonnull object);

/*
 * Used by the compiler, but can also be called manually.
 *
 * These declarations are also required to prevent Clang's implicit
 * declarations which include __declspec(dllimport) on Windows.
 */
struct objc_module;