mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-22 16:33:29 +00:00
Merge pull request #164 from triplef/add-nsfilehandle-url-methods
Add NSFileHandle URL initializers.
This commit is contained in:
commit
d27dcfbed6
4 changed files with 55 additions and 14 deletions
|
@ -1,3 +1,12 @@
|
|||
2020-11-17 Frederik Seiffert <frederik@algoriddim.com>
|
||||
|
||||
* Headers/Foundation/NSFileHandle.h,
|
||||
* Source/NSFileHandle.h: Add NSFileHandle URL initializers:
|
||||
-fileHandleForReadingFromURL:error:
|
||||
-fileHandleForWritingToURL:error:
|
||||
-fileHandleForUpdatingURL:error:
|
||||
Also use "instancetype" for all initializers.
|
||||
|
||||
2020-10-11 Adam Fox <adam.fox@eggplantsoftware.com>
|
||||
|
||||
* Source/NSData.m: Implement rangeOfData:options:range.
|
||||
|
|
|
@ -38,18 +38,25 @@ extern "C" {
|
|||
|
||||
@class NSData;
|
||||
@class NSString;
|
||||
@class NSError;
|
||||
|
||||
@interface NSFileHandle : NSObject
|
||||
|
||||
// Allocating and Initializing a FileHandle Object
|
||||
|
||||
+ (id) fileHandleForReadingAtPath: (NSString*)path;
|
||||
+ (id) fileHandleForWritingAtPath: (NSString*)path;
|
||||
+ (id) fileHandleForUpdatingAtPath: (NSString*)path;
|
||||
+ (id) fileHandleWithStandardError;
|
||||
+ (id) fileHandleWithStandardInput;
|
||||
+ (id) fileHandleWithStandardOutput;
|
||||
+ (id) fileHandleWithNullDevice;
|
||||
+ (instancetype) fileHandleForReadingAtPath: (NSString*)path;
|
||||
+ (instancetype) fileHandleForWritingAtPath: (NSString*)path;
|
||||
+ (instancetype) fileHandleForUpdatingAtPath: (NSString*)path;
|
||||
+ (instancetype) fileHandleWithStandardError;
|
||||
+ (instancetype) fileHandleWithStandardInput;
|
||||
+ (instancetype) fileHandleWithStandardOutput;
|
||||
+ (instancetype) fileHandleWithNullDevice;
|
||||
|
||||
#if OS_API_VERSION(MAC_OS_X_VERSION_10_6, GS_API_LATEST)
|
||||
+ (instancetype) fileHandleForReadingFromURL: (NSURL*)url error:(NSError**)error;
|
||||
+ (instancetype) fileHandleForWritingToURL: (NSURL*)url error:(NSError**)error;
|
||||
+ (instancetype) fileHandleForUpdatingURL: (NSURL*)url error:(NSError**)error;
|
||||
#endif
|
||||
|
||||
- (id) initWithFileDescriptor: (int)desc;
|
||||
- (id) initWithFileDescriptor: (int)desc closeOnDealloc: (BOOL)flag;
|
||||
|
|
8
MISSING
8
MISSING
|
@ -200,15 +200,9 @@ NSExpression:
|
|||
- rightExpression
|
||||
- expressionBlock
|
||||
-------------------------------------------------------------
|
||||
NSFileHandler:
|
||||
NSFileHandle:
|
||||
<NSArray.h>
|
||||
|
||||
@class NSError
|
||||
|
||||
+ fileHandleForReadingFromURL:error:
|
||||
+ fileHandleForWritingToURL:error:
|
||||
+ fileHandleForUpdatingURL:error:
|
||||
|
||||
@property (copy) void (^readabilityHandler)(NSFileHandle *)
|
||||
@property (copy) void (^writeabilityHandler)(NSFileHandle *)
|
||||
-------------------------------------------------------------
|
||||
|
|
|
@ -32,6 +32,7 @@
|
|||
#import "Foundation/NSHost.h"
|
||||
#import "Foundation/NSFileHandle.h"
|
||||
#import "Foundation/NSPathUtilities.h"
|
||||
#import "Foundation/NSURL.h"
|
||||
#import "GNUstepBase/GSTLS.h"
|
||||
#import "GNUstepBase/NSString+GNUstepBase.h"
|
||||
#import "GSPrivate.h"
|
||||
|
@ -198,6 +199,36 @@ static Class NSFileHandle_ssl_class = nil;
|
|||
return AUTORELEASE([o initWithNullDevice]);
|
||||
}
|
||||
|
||||
+ (id) fileHandleForReadingFromURL: (NSURL*)url error:(NSError**)error
|
||||
{
|
||||
id o = [self fileHandleForReadingAtPath: [url path]];
|
||||
if (!o && error)
|
||||
{
|
||||
*error = [NSError _last];
|
||||
}
|
||||
return o;
|
||||
}
|
||||
|
||||
+ (id) fileHandleForWritingToURL: (NSURL*)url error:(NSError**)error
|
||||
{
|
||||
id o = [self fileHandleForWritingAtPath: [url path]];
|
||||
if (!o && error)
|
||||
{
|
||||
*error = [NSError _last];
|
||||
}
|
||||
return o;
|
||||
}
|
||||
|
||||
+ (id) fileHandleForUpdatingURL: (NSURL*)url error:(NSError**)error
|
||||
{
|
||||
id o = [self fileHandleForUpdatingAtPath: [url path]];
|
||||
if (!o && error)
|
||||
{
|
||||
*error = [NSError _last];
|
||||
}
|
||||
return o;
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize with desc, which can point to either a regular file or
|
||||
* socket connection.
|
||||
|
|
Loading…
Reference in a new issue