Index: src/OFObject.h ================================================================== --- src/OFObject.h +++ src/OFObject.h @@ -207,19 +207,19 @@ /** * \brief Performs the specified selector with the specified objects. * * \param selector The selector to perform - * \param object The first object that is passed to the method specified by the + * \param object1 The first object that is passed to the method specified by the * selector - * \param otherObject The second object that is passed to the method specified - * by the selector + * \param object2 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)object - withObject: (id)otherObject; + withObject: (id)object1 + withObject: (id)object2; /** * \brief Checks two objects for equality. * * Classes containing data (like strings, arrays, lists etc.) should reimplement @@ -595,10 +595,48 @@ * It is automatically called when the retain count reaches zero. * * This also frees all memory in its memory pool. */ - (void)dealloc; + +/** + * \brief Performs the specified selector after the specified delay. + * + * \param selector The selector to perform + * \param delay The delay after which the selector will be performed + */ +- (void)performSelector: (SEL)selector + afterDelay: (double)delay; + +/** + * \brief Performs the specified selector with the specified object after the + * specified delay. + * + * \param selector The selector to perform + * \param object The object that is passed to the method specified by the + * selector + * \param delay The delay after which the selector will be performed + */ +- (void)performSelector: (SEL)selector + withObject: (id)object + afterDelay: (double)delay; + +/** + * \brief Performs the specified selector with the specified objects after the + * specified delay. + * + * \param selector The selector to perform + * \param object1 The first object that is passed to the method specified by the + * selector + * \param object2 The second object that is passed to the method specified by + * the selector + * \param delay The delay after which the selector will be performed + */ +- (void)performSelector: (SEL)selector + withObject: (id)object1 + withObject: (id)object2 + afterDelay: (double)delay; @end /** * \brief A protocol for the creation of copies. */ Index: src/OFObject.m ================================================================== --- src/OFObject.m +++ src/OFObject.m @@ -29,10 +29,11 @@ #ifdef __QNX__ # include #endif #import "OFObject.h" +#import "OFTimer.h" #import "OFAllocFailedException.h" #import "OFEnumerationMutationException.h" #import "OFInitializationFailedException.h" #import "OFInvalidArgumentException.h" @@ -574,10 +575,55 @@ id (*imp)(id, SEL, id, id) = (id(*)(id, SEL, id, id))[self methodForSelector: selector]; return imp(self, selector, object, otherObject); } + +- (void)performSelector: (SEL)selector + afterDelay: (double)delay +{ + void *pool = objc_autoreleasePoolPush(); + + [OFTimer scheduledTimerWithTimeInterval: delay + target: self + selector: selector + repeats: NO]; + + objc_autoreleasePoolPop(pool); +} + +- (void)performSelector: (SEL)selector + withObject: (id)object + afterDelay: (double)delay +{ + void *pool = objc_autoreleasePoolPush(); + + [OFTimer scheduledTimerWithTimeInterval: delay + target: self + selector: selector + object: object + repeats: NO]; + + objc_autoreleasePoolPop(pool); +} + +- (void)performSelector: (SEL)selector + withObject: (id)object + withObject: (id)otherObject + afterDelay: (double)delay +{ + void *pool = objc_autoreleasePoolPush(); + + [OFTimer scheduledTimerWithTimeInterval: delay + target: self + selector: selector + object: object + object: object + repeats: NO]; + + objc_autoreleasePoolPop(pool); +} - (const char*)typeEncodingForSelector: (SEL)selector { #if defined(OF_OBJFW_RUNTIME) const char *ret;