mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-22 16:33:29 +00:00
Add methods for 10.5
This commit is contained in:
parent
36da869287
commit
85f590f88e
4 changed files with 77 additions and 4 deletions
|
@ -34,12 +34,18 @@ extern "C" {
|
|||
|
||||
@class NSTimer, NSDate, NSPort;
|
||||
|
||||
typedef NSString* NSRunLoopMode;
|
||||
|
||||
/**
|
||||
* Run loop mode used to deal with input sources other than NSConnections or
|
||||
* dialog windows. Most commonly used. Defined in
|
||||
* <code>Foundation/NSRunLoop.h</code>.
|
||||
*/
|
||||
GS_EXPORT NSString * const NSDefaultRunLoopMode;
|
||||
GS_EXPORT NSRunLoopMode const NSDefaultRunLoopMode;
|
||||
GS_EXPORT NSRunLoopMode const NSRunLoopCommonModes;
|
||||
GS_EXPORT NSRunLoopMode const NSEventTrackingRunLoopMode;
|
||||
GS_EXPORT NSRunLoopMode const NSModalPanelRunLoopMode;
|
||||
GS_EXPORT NSRunLoopMode const UITrackingRunLoopMode;
|
||||
|
||||
@interface NSRunLoop : NSObject
|
||||
{
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
#if OS_API_VERSION(MAC_OS_X_VERSION_10_2,GS_API_LATEST) && GS_API_VERSION( 11300,GS_API_LATEST)
|
||||
|
||||
#import <Foundation/NSObject.h>
|
||||
#import <Foundation/NSRunLoop.h>
|
||||
|
||||
#if defined(__cplusplus)
|
||||
extern "C" {
|
||||
|
@ -66,11 +67,23 @@ extern "C" {
|
|||
+ (NSURLConnection *) connectionWithRequest: (NSURLRequest *)request
|
||||
delegate: (id)delegate;
|
||||
|
||||
/**
|
||||
* Start the asynchronous load. This method is only needed if NO is passed
|
||||
* into startImmediately when calling initWithRequest: delegate: startImmediately.
|
||||
*/
|
||||
- (void) start;
|
||||
|
||||
/**
|
||||
* Cancel the asynchronous load in progress (if any) for this connection.
|
||||
*/
|
||||
- (void) cancel;
|
||||
|
||||
- (void) scheduleInRunLoop: (NSRunLoop *)aRunLoop
|
||||
forMode: (NSRunLoopMode)mode;
|
||||
|
||||
- (void) unscheduleFromRunLoop: (NSRunLoop *)aRunLoop
|
||||
forMode: (NSRunLoopMode)mode;
|
||||
|
||||
/** <init />
|
||||
* Initialises the receiver with the specified request (performing
|
||||
* a deep copy so that the request does not change during loading)
|
||||
|
@ -86,6 +99,22 @@ extern "C" {
|
|||
*/
|
||||
- (id) initWithRequest: (NSURLRequest *)request delegate: (id)delegate;
|
||||
|
||||
/** <init />
|
||||
* Initialises the receiver with the specified request (performing
|
||||
* a deep copy so that the request does not change during loading)
|
||||
* and delegate.<br />
|
||||
* This automatically initiates an asynchronous load for the request
|
||||
* if and only if startImmediately is set to YES.<br />
|
||||
* Processing of the request is done in the thread which calls this
|
||||
* method, so the thread must run its current run loop
|
||||
* (in NSDefaultRunLoopMode) for processing to continue/complete.<br />
|
||||
* The delegate will receive callbacks informing it of the progress
|
||||
* of the load.<br />
|
||||
* This method breaks with convention and retains the delegate object,
|
||||
* releasing it when the connection finished loading, fails, or is cancelled.
|
||||
*/
|
||||
- (id) initWithRequest: (NSURLRequest *)request delegate: (id)delegate startImmediately: (BOOL)startImmediately;
|
||||
|
||||
@end
|
||||
|
||||
|
||||
|
|
|
@ -74,7 +74,11 @@
|
|||
#endif
|
||||
|
||||
|
||||
NSString * const NSDefaultRunLoopMode = @"NSDefaultRunLoopMode";
|
||||
NSRunLoopMode const NSDefaultRunLoopMode = @"NSDefaultRunLoopMode";
|
||||
NSRunLoopMode const NSRunLoopCommonModes = @"NSRunLoopCommonModes";
|
||||
NSRunLoopMode const NSEventTrackingRunLoopMode = @"NSEventTrackingRunLoopMode";
|
||||
NSRunLoopMode const NSModalPanelRunLoopMode = @"NSModalPanelRunLoopMode";
|
||||
NSRunLoopMode const UITrackingRunLoopMode = @"UITrackingRunLoopMode";
|
||||
|
||||
static NSDate *theFuture = nil;
|
||||
|
||||
|
|
|
@ -157,6 +157,11 @@ typedef struct
|
|||
return AUTORELEASE(o);
|
||||
}
|
||||
|
||||
- (void) start
|
||||
{
|
||||
[this->_protocol startLoading];
|
||||
}
|
||||
|
||||
- (void) cancel
|
||||
{
|
||||
[this->_protocol stopLoading];
|
||||
|
@ -164,6 +169,25 @@ typedef struct
|
|||
DESTROY(this->_delegate);
|
||||
}
|
||||
|
||||
- (void) scheduleInRunLoop: (NSRunLoop *)aRunLoop
|
||||
forMode: (NSRunLoopMode)mode
|
||||
{
|
||||
NSArray *modes = [NSArray arrayWithObject: mode];
|
||||
[aRunLoop performSelector: @selector(start)
|
||||
target: self
|
||||
argument: nil
|
||||
order: 0
|
||||
modes: modes];
|
||||
}
|
||||
|
||||
- (void) unscheduleFromRunLoop: (NSRunLoop *)aRunLoop
|
||||
forMode: (NSRunLoopMode)mode
|
||||
{
|
||||
[aRunLoop cancelPerformSelector: @selector(start)
|
||||
target: self
|
||||
argument: nil];
|
||||
}
|
||||
|
||||
- (void) dealloc
|
||||
{
|
||||
if (this != 0)
|
||||
|
@ -185,7 +209,7 @@ typedef struct
|
|||
}
|
||||
}
|
||||
|
||||
- (id) initWithRequest: (NSURLRequest *)request delegate: (id)delegate
|
||||
- (id) initWithRequest: (NSURLRequest *)request delegate: (id)delegate startImmediately: (BOOL)startImmediately
|
||||
{
|
||||
if ((self = [super init]) != nil)
|
||||
{
|
||||
|
@ -226,12 +250,22 @@ typedef struct
|
|||
initWithRequest: this->_request
|
||||
cachedResponse: nil
|
||||
client: (id<NSURLProtocolClient>)self];
|
||||
[this->_protocol startLoading];
|
||||
if (startImmediately == YES)
|
||||
{
|
||||
[this->_protocol startLoading];
|
||||
}
|
||||
this->_debug = GSDebugSet(@"NSURLConnection");
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (id) initWithRequest: (NSURLRequest *)request delegate: (id)delegate
|
||||
{
|
||||
return [self initWithRequest: request
|
||||
delegate: delegate
|
||||
startImmediately: YES];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue