ObjFW  Check-in [c3f3576af4]

Overview
Comment:Add -[performSelector:] and friends to OFObject.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: c3f3576af4918388495cd30c8dabf0497e51c9b83c21295e14d91abfba9fbbfa
User & Date: js on 2011-03-25 12:30:52
Other Links: manifest | tags
Context
2011-03-25
12:47
Add -[makeObjectsPerformSelector:] and friends to OFArray. check-in: 3a6d41c6a3 user: js tags: trunk
12:30
Add -[performSelector:] and friends to OFObject. check-in: c3f3576af4 user: js tags: trunk
03:28
Export LIBRARY_PATH (for Haiku). check-in: ffad44fe10 user: js tags: trunk
Changes

Modified src/OFObject.h from [bcf048ad36] to [20ad48203c].

77
78
79
80
81
82
83
































84
85
86
87
88
89
90

/**
 * \param selector The selector which should be checked for respondance
 * \return A boolean whether the objects responds to the specified selector
 */
- (BOOL)respondsToSelector: (SEL)selector;

































/**
 * Checks two objects for equality.
 *
 * Classes containing data (like strings, arrays, lists etc.) should reimplement
 * this!
 *
 * \param obj The object which should be tested for equality







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







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

/**
 * \param selector The selector which should be checked for respondance
 * \return A boolean whether the objects responds to the specified selector
 */
- (BOOL)respondsToSelector: (SEL)selector;

/**
 * Performs the specified selector.
 *
 * \param selector The selector to perform
 * \return The object returned by the method specified by the selector
 */
- (id)performSelector: (SEL)selector;

/**
 * Performs the specified selector with the specified object.
 *
 * \param selector The selector to perform
 * \param obj The object that is passed to the method specified by the selector
 * \return The object returned by the method specified by the selector
 */
- (id)performSelector: (SEL)selector
	   withObject: (id)obj;

/**
 * Performs the specified selector with the specified objects.
 *
 * \param selector The selector to perform
 * \param obj1 The first object that is passed to the method specified by the
 *             selector
 * \param obj2 The second object that is passed to the method specified by the
 *             selector
 * \return The object returned by the method specified by the selector
 */
- (id)performSelector: (SEL)selector
	   withObject: (id)obj1
	   withObject: (id)obj2;

/**
 * Checks two objects for equality.
 *
 * Classes containing data (like strings, arrays, lists etc.) should reimplement
 * this!
 *
 * \param obj The object which should be tested for equality

Modified src/OFObject.m from [fde9d39d7a] to [fc3fc31d4e].

477
478
479
480
481
482
483
























484
485
486
487
488
489
490
{
#if defined(OF_OBJFW_RUNTIME) || defined(OF_OLD_GNU_RUNTIME)
	return objc_msg_lookup(self, selector);
#else
	return class_getMethodImplementation(isa, selector);
#endif
}

























- (const char*)typeEncodingForSelector: (SEL)selector
{
#if defined(OF_OBJFW_RUNTIME)
	const char *ret;

	if ((ret = objc_get_type_encoding(isa, selector)) == NULL)







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







477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
{
#if defined(OF_OBJFW_RUNTIME) || defined(OF_OLD_GNU_RUNTIME)
	return objc_msg_lookup(self, selector);
#else
	return class_getMethodImplementation(isa, selector);
#endif
}

- (id)performSelector: (SEL)selector
{
	id (*imp)() = (id(*)())[self methodForSelector: selector];

	return imp();
}

- (id)performSelector: (SEL)selector
	   withObject: (id)obj
{
	id (*imp)(id) = (id(*)(id))[self methodForSelector: selector];

	return imp(obj);
}

- (id)performSelector: (SEL)selector
	   withObject: (id)obj1
	   withObject: (id)obj2
{
	id (*imp)(id, id) = (id(*)(id, id))[self methodForSelector: selector];

	return imp(obj1, obj2);
}

- (const char*)typeEncodingForSelector: (SEL)selector
{
#if defined(OF_OBJFW_RUNTIME)
	const char *ret;

	if ((ret = objc_get_type_encoding(isa, selector)) == NULL)