ObjFW  Diff

Differences From Artifact [e279082981]:

To Artifact [9620b63ed6]:


108
109
110
111
112
113
114









115
116
117
118
119
120
121
 * \brief Returns a boolean whether the object of the specified kind.
 *
 * \param class_ The class whose kind is checked
 * \return A boolean whether the object is of the specified kind
 */
- (BOOL)isKindOfClass: (Class)class_;










/**
 * \brief Returns a boolean whether the object responds to the specified
 *	  selector.
 *
 * \param selector The selector which should be checked for respondance
 * \return A boolean whether the objects responds to the specified selector
 */







>
>
>
>
>
>
>
>
>







108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
 * \brief Returns a boolean whether the object of the specified kind.
 *
 * \param class_ The class whose kind is checked
 * \return A boolean whether the object is of the specified kind
 */
- (BOOL)isKindOfClass: (Class)class_;

/**
 * \brief Returns a boolean whether the object is a member of the specified
 *	  class.
 *
 * \param class_ The class for which the receiver is checked
 * \return A boolean whether the object is a member of the specified class
 */
- (BOOL)isMemberOfClass: (Class)class_;

/**
 * \brief Returns a boolean whether the object responds to the specified
 *	  selector.
 *
 * \param selector The selector which should be checked for respondance
 * \return A boolean whether the objects responds to the specified selector
 */
232
233
234
235
236
237
238







239
240
241
242
243
244
245

/**
 * \brief Returns the receiver.
 *
 * \return The receiver
 */
- self;







@end

/**
 * \brief The root class for all other classes inside ObjFW.
 */
@interface OFObject <OFObject>
{







>
>
>
>
>
>
>







241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261

/**
 * \brief Returns the receiver.
 *
 * \return The receiver
 */
- self;

/**
 * \brief Returns whether the object is a proxy object.
 *
 * \return A boolean whether the object is a proxy object
 */
- (BOOL)isProxy;
@end

/**
 * \brief The root class for all other classes inside ObjFW.
 */
@interface OFObject <OFObject>
{
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412

413
414
415
416
417

418
419
420
421
422
423
424
425
426
427
428

429
430
431
432
433

434
435
436
437
438
439
440
441
442
 *
 * This is mostly for debugging purposes.
 *
 * \return A description for the class, which is usually the class name
 */
+ (OFString*)description;

/**
 * \brief Replaces a class method implementation with another implementation.
 *
 * \param newImp The new implementation for the class method
 * \param selector The selector of the class method to replace
 * \return The old implementation
 */
+ (IMP)setImplementation: (IMP)newImp
	  forClassMethod: (SEL)selector;

/**
 * \brief Replaces a class method with a class method from another class.
 *
 * \param selector The selector of the class method to replace
 * \param class_ The class from which the new class method should be taken
 * \return The old implementation
 */
+ (IMP)replaceClassMethod: (SEL)selector
      withMethodFromClass: (Class)class_;

/**
 * \brief Replaces an instance method implementation with another
 *	  implementation.
 *
 * \param newImp The new implementation for the instance method
 * \param selector The selector of the instance method to replace
 * \return The old implementation
 */
+ (IMP)setImplementation: (IMP)newImp
       forInstanceMethod: (SEL)selector;

/**
 * \brief Replaces an instance method with an instance method from another
 *	  class.
 *
 * \param selector The selector of the instance method to replace
 * \param class_ The class from which the new instance method should be taken
 * \return The old implementation
 */
+ (IMP)replaceInstanceMethod: (SEL)selector
	 withMethodFromClass: (Class)class_;

/**
 * \brief Adds a class method to the class.
 *
 * If the method already exists, nothing is done and NO is returned. If you want
 * to change the implementation of a method, use
 * setImplementation:forClassMethod:.
 *
 * \param selector The selector for the new method

 * \param typeEncoding The type encoding for the new method
 * \param implementation The implementation for the new method
 * \return Whether the method has been added
 */
+ (BOOL)addClassMethod: (SEL)selector

      withTypeEncoding: (const char*)typeEncoding
	implementation: (IMP)implementation;

/**
 * \brief Adds an instance method to the class.
 *
 * If the method already exists, nothing is done and NO is returned. If you want
 * to change the implementation of a method, use
 * setImplementation:forInstanceMethod:.
 *
 * \param selector The selector for the new method

 * \param typeEncoding The type encoding for the new method
 * \param implementation The implementation for the new method
 * \return Whether the method has been added
 */
+ (BOOL)addInstanceMethod: (SEL)selector

	 withTypeEncoding: (const char*)typeEncoding
	   implementation: (IMP)implementation;

/**
 * \brief Adds all methods from the specified class to the class that is the
 *	  receiver.
 *
 * Methods implemented by the receiving class itself will not be overridden,
 * however methods implemented by its superclass will. Therefore it behaves







<
<
<
<
<
<
<
<
<
<










<
<
<
<
<
<
<
<
<
<
<












|

|
|
|


>

|
<

|
>
|
<


|

|
|
|


>

|
<

|
>
|
<







372
373
374
375
376
377
378










379
380
381
382
383
384
385
386
387
388











389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410

411
412
413
414

415
416
417
418
419
420
421
422
423
424
425
426

427
428
429
430

431
432
433
434
435
436
437
 *
 * This is mostly for debugging purposes.
 *
 * \return A description for the class, which is usually the class name
 */
+ (OFString*)description;











/**
 * \brief Replaces a class method with a class method from another class.
 *
 * \param selector The selector of the class method to replace
 * \param class_ The class from which the new class method should be taken
 * \return The old implementation
 */
+ (IMP)replaceClassMethod: (SEL)selector
      withMethodFromClass: (Class)class_;












/**
 * \brief Replaces an instance method with an instance method from another
 *	  class.
 *
 * \param selector The selector of the instance method to replace
 * \param class_ The class from which the new instance method should be taken
 * \return The old implementation
 */
+ (IMP)replaceInstanceMethod: (SEL)selector
	 withMethodFromClass: (Class)class_;

/**
 * \brief Replaces or adds a class method.
 *
 * If the method already exists, it is replaced and the old implementation
 * returned. If the method does not exist, it is added with the specified type
 * encoding.
 *
 * \param selector The selector for the new method
 * \param implementation The implementation for the new method
 * \param typeEncoding The type encoding for the new method
 * \return The old implementation or nil if the method was added

 */
+ (IMP)replaceClassMethod: (SEL)selector
       withImplementation: (IMP)implementation
	     typeEncoding: (const char*)typeEncoding;


/**
 * \brief Replaces or adds an instance method.
 *
 * If the method already exists, it is replaced and the old implementation
 * returned. If the method does not exist, it is added with the specified type
 * encoding.
 *
 * \param selector The selector for the new method
 * \param implementation The implementation for the new method
 * \param typeEncoding The type encoding for the new method
 * \return The old implementation or nil if the method was added

 */
+ (IMP)replaceInstanceMethod: (SEL)selector
	  withImplementation: (IMP)implementation
		typeEncoding: (const char*)typeEncoding;


/**
 * \brief Adds all methods from the specified class to the class that is the
 *	  receiver.
 *
 * Methods implemented by the receiving class itself will not be overridden,
 * however methods implemented by its superclass will. Therefore it behaves
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
 *
 * This is mostly for debugging purposes.
 *
 * \return A description for the object
 */
- (OFString*)description;

/**
 * \brief Adds a pointer to the object's memory pool.
 *
 * This is useful to add memory allocated by functions such as asprintf to the
 * pool so it gets free'd automatically when the object is deallocated.
 *
 * \param pointer A pointer to add to the memory pool
 */
- (void)addMemoryToPool: (void*)pointer;

/**
 * \brief Allocates memory and stores it in the object's memory pool.
 *
 * It will be free'd automatically when the object is deallocated.
 *
 * \param size The size of the memory to allocate
 * \return A pointer to the allocated memory







<
<
<
<
<
<
<
<
<
<







472
473
474
475
476
477
478










479
480
481
482
483
484
485
 *
 * This is mostly for debugging purposes.
 *
 * \return A description for the object
 */
- (OFString*)description;











/**
 * \brief Allocates memory and stores it in the object's memory pool.
 *
 * It will be free'd automatically when the object is deallocated.
 *
 * \param size The size of the memory to allocate
 * \return A pointer to the allocated memory
609
610
611
612
613
614
615
616
617
618


619
620
621
@end

#import "OFObject+Serialization.h"

#ifdef __cplusplus
extern "C" {
#endif
extern id objc_getProperty(id, SEL, ptrdiff_t, BOOL);
extern void objc_setProperty(id, SEL, ptrdiff_t, id, BOOL, BOOL);
extern size_t of_pagesize;


#ifdef __cplusplus
}
#endif







|
<
|
>
>



594
595
596
597
598
599
600
601

602
603
604
605
606
607
@end

#import "OFObject+Serialization.h"

#ifdef __cplusplus
extern "C" {
#endif
extern size_t of_pagesize;

extern size_t of_num_cpus;
extern id of_alloc_object(Class class_, size_t extraSize, size_t extraAlignment,
    void **extra);
#ifdef __cplusplus
}
#endif