mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-30 08:21:25 +00:00
NSObject and NSRunLoop updates for MacOS-X compatibility
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@14349 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
a9de34eb69
commit
c45f681d6d
4 changed files with 84 additions and 0 deletions
|
@ -138,6 +138,7 @@
|
||||||
+ (IMP) instanceMethodForSelector: (SEL)aSelector;
|
+ (IMP) instanceMethodForSelector: (SEL)aSelector;
|
||||||
+ (NSMethodSignature*) instanceMethodSignatureForSelector: (SEL)aSelector;
|
+ (NSMethodSignature*) instanceMethodSignatureForSelector: (SEL)aSelector;
|
||||||
+ (BOOL) instancesRespondToSelector: (SEL)aSelector;
|
+ (BOOL) instancesRespondToSelector: (SEL)aSelector;
|
||||||
|
+ (BOOL) isSubclassOfClass: (Class)aClass;
|
||||||
+ (id) new;
|
+ (id) new;
|
||||||
+ (void) poseAsClass: (Class)aClassObject;
|
+ (void) poseAsClass: (Class)aClassObject;
|
||||||
+ (id) setVersion: (int)aVersion;
|
+ (id) setVersion: (int)aVersion;
|
||||||
|
@ -306,6 +307,7 @@ GS_EXPORT NSRecursiveLock *gnustep_global_lock;
|
||||||
|
|
||||||
#include <Foundation/NSDate.h>
|
#include <Foundation/NSDate.h>
|
||||||
@interface NSObject (TimedPerformers)
|
@interface NSObject (TimedPerformers)
|
||||||
|
+ (void) cancelPreviousPerformRequestsWithTarget: (id)obj;
|
||||||
+ (void) cancelPreviousPerformRequestsWithTarget: (id)obj
|
+ (void) cancelPreviousPerformRequestsWithTarget: (id)obj
|
||||||
selector: (SEL)s
|
selector: (SEL)s
|
||||||
object: (id)arg;
|
object: (id)arg;
|
||||||
|
|
|
@ -67,6 +67,8 @@ GS_EXPORT NSString * const NSDefaultRunLoopMode;
|
||||||
- (void) addPort: (NSPort*)port
|
- (void) addPort: (NSPort*)port
|
||||||
forMode: (NSString*)mode;
|
forMode: (NSString*)mode;
|
||||||
|
|
||||||
|
- (void) cancelPerformSelectorsWithTarget: (id)target;
|
||||||
|
|
||||||
- (void) cancelPerformSelector: (SEL)aSelector
|
- (void) cancelPerformSelector: (SEL)aSelector
|
||||||
target: (id)target
|
target: (id)target
|
||||||
argument: (id)argument;
|
argument: (id)argument;
|
||||||
|
|
|
@ -1494,6 +1494,14 @@ static BOOL double_release_check_enabled = NO;
|
||||||
return NO;
|
return NO;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns YES if the receiver is aClass or a subclass of aClass.
|
||||||
|
*/
|
||||||
|
+ (BOOL) isSubclassOfClass: (Class)aClass
|
||||||
|
{
|
||||||
|
return GSObjCIsKindOf(self, aClass);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Causes the receiver to execute the method implementation corresponding
|
* Causes the receiver to execute the method implementation corresponding
|
||||||
* to aSelector and returns the result.<br />
|
* to aSelector and returns the result.<br />
|
||||||
|
|
|
@ -1192,6 +1192,39 @@ if (0) {
|
||||||
|
|
||||||
@implementation NSObject (TimedPerformers)
|
@implementation NSObject (TimedPerformers)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Cancels any perform operations set up for the specified target
|
||||||
|
* in the current run loop.
|
||||||
|
*/
|
||||||
|
+ (void) cancelPreviousPerformRequestsWithTarget: (id)target
|
||||||
|
{
|
||||||
|
NSMutableArray *perf = [[NSRunLoop currentRunLoop] _timedPerformers];
|
||||||
|
unsigned count = [perf count];
|
||||||
|
|
||||||
|
if (count > 0)
|
||||||
|
{
|
||||||
|
GSTimedPerformer *array[count];
|
||||||
|
|
||||||
|
IF_NO_GC(RETAIN(target));
|
||||||
|
[perf getObjects: array];
|
||||||
|
while (count-- > 0)
|
||||||
|
{
|
||||||
|
GSTimedPerformer *p = array[count];
|
||||||
|
|
||||||
|
if (p->target == target)
|
||||||
|
{
|
||||||
|
[perf removeObjectAtIndex: count];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
RELEASE(target);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Cancels any perform operations set up for the specified target
|
||||||
|
* in the current loop, but only if the vaslue of aSelector and argument
|
||||||
|
* with which the performs were set up exactly match those supplied.
|
||||||
|
*/
|
||||||
+ (void) cancelPreviousPerformRequestsWithTarget: (id)target
|
+ (void) cancelPreviousPerformRequestsWithTarget: (id)target
|
||||||
selector: (SEL)aSelector
|
selector: (SEL)aSelector
|
||||||
object: (id)arg
|
object: (id)arg
|
||||||
|
@ -2087,6 +2120,45 @@ if (0) {
|
||||||
forMode: (NSString*)mode];
|
forMode: (NSString*)mode];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Cancels any perform operations set up for the specified target
|
||||||
|
* in the receiver.
|
||||||
|
*/
|
||||||
|
- (void) cancelPerformSelectorsWithTarget: (id) target
|
||||||
|
{
|
||||||
|
NSMapEnumerator enumerator;
|
||||||
|
GSRunLoopCtxt *context;
|
||||||
|
void *mode;
|
||||||
|
|
||||||
|
enumerator = NSEnumerateMapTable(_contextMap);
|
||||||
|
|
||||||
|
while (NSNextMapEnumeratorPair(&enumerator, &mode, (void**)&context))
|
||||||
|
{
|
||||||
|
if (context != nil)
|
||||||
|
{
|
||||||
|
GSIArray performers = context->performers;
|
||||||
|
unsigned count = GSIArrayCount(performers);
|
||||||
|
|
||||||
|
while (count--)
|
||||||
|
{
|
||||||
|
GSRunLoopPerformer *p;
|
||||||
|
|
||||||
|
p = GSIArrayItemAtIndex(performers, count).obj;
|
||||||
|
if (p->target == target)
|
||||||
|
{
|
||||||
|
GSIArrayRemoveItemAtIndex(performers, count);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
NSEndMapTableEnumeration(&enumerator);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Cancels any perform operations set up for the specified target
|
||||||
|
* in the receiver, but only if the vaslue of aSelector and argument
|
||||||
|
* with which the performs were set up exactly match those supplied.
|
||||||
|
*/
|
||||||
- (void) cancelPerformSelector: (SEL)aSelector
|
- (void) cancelPerformSelector: (SEL)aSelector
|
||||||
target: (id) target
|
target: (id) target
|
||||||
argument: (id) argument
|
argument: (id) argument
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue