mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-30 16:30:41 +00:00
Formatting tidyups
This commit is contained in:
parent
2adc5c5959
commit
1fe008304a
2 changed files with 58 additions and 53 deletions
|
@ -100,12 +100,13 @@ GS_EXPORT_CLASS
|
||||||
|
|
||||||
#if OS_API_VERSION(MAC_OS_X_VERSION_10_11, GS_API_LATEST)
|
#if OS_API_VERSION(MAC_OS_X_VERSION_10_11, GS_API_LATEST)
|
||||||
+ (instancetype) fileURLWithPath: (NSString *)aPath
|
+ (instancetype) fileURLWithPath: (NSString *)aPath
|
||||||
isDirectory: (BOOL)isDir
|
isDirectory: (BOOL)isDir
|
||||||
relativeToURL: (NSURL *)baseURL;
|
relativeToURL: (NSURL *)baseURL;
|
||||||
|
|
||||||
/** Create and return a file URL with the supplied path, relative to a base URL.
|
/** Create and return a file URL with the supplied path, relative to a base URL.
|
||||||
*/
|
*/
|
||||||
+ (instancetype) fileURLWithPath:(NSString *)aPath relativeToURL:(NSURL *)baseURL;
|
+ (instancetype) fileURLWithPath: (NSString *)aPath
|
||||||
|
relativeToURL: (NSURL *)baseURL;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -167,7 +168,7 @@ GS_EXPORT_CLASS
|
||||||
* Calls -initWithScheme:host:path:
|
* Calls -initWithScheme:host:path:
|
||||||
*/
|
*/
|
||||||
- (instancetype) initFileURLWithPath: (NSString *)aPath
|
- (instancetype) initFileURLWithPath: (NSString *)aPath
|
||||||
relativeToURL: (NSURL *)baseURL;
|
relativeToURL: (NSURL *)baseURL;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initialise as a file URL with the specified path (which must
|
* Initialise as a file URL with the specified path (which must
|
||||||
|
@ -179,8 +180,8 @@ GS_EXPORT_CLASS
|
||||||
* Calls -initWithScheme:host:path:
|
* Calls -initWithScheme:host:path:
|
||||||
*/
|
*/
|
||||||
- (instancetype) initFileURLWithPath: (NSString *)aPath
|
- (instancetype) initFileURLWithPath: (NSString *)aPath
|
||||||
isDirectory: (BOOL)isDir
|
isDirectory: (BOOL)isDir
|
||||||
relativeToURL: (NSURL *)baseURL;
|
relativeToURL: (NSURL *)baseURL;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -456,8 +457,8 @@ GS_EXPORT_CLASS
|
||||||
* directory.<br />
|
* directory.<br />
|
||||||
* See [NSString-stringByAppendingPathComponent:].
|
* See [NSString-stringByAppendingPathComponent:].
|
||||||
*/
|
*/
|
||||||
- (NSURL *) URLByAppendingPathComponent:(NSString *)pathComponent
|
- (NSURL *) URLByAppendingPathComponent: (NSString *)pathComponent
|
||||||
isDirectory:(BOOL)isDirectory;
|
isDirectory: (BOOL)isDirectory;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if OS_API_VERSION(MAC_OS_X_VERSION_10_6, GS_API_LATEST)
|
#if OS_API_VERSION(MAC_OS_X_VERSION_10_6, GS_API_LATEST)
|
||||||
|
@ -670,10 +671,10 @@ GS_NSURLQueryItem_IVARS;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Creating query items.
|
// Creating query items.
|
||||||
+ (instancetype)queryItemWithName:(NSString *)name
|
+ (instancetype)queryItemWithName: (NSString *)name
|
||||||
value:(NSString *)value;
|
value: (NSString *)value;
|
||||||
- (instancetype)initWithName:(NSString *)name
|
- (instancetype)initWithName: (NSString *)name
|
||||||
value:(NSString *)value;
|
value: (NSString *)value;
|
||||||
|
|
||||||
// Reading a name and value from a query
|
// Reading a name and value from a query
|
||||||
- (NSString *) name;
|
- (NSString *) name;
|
||||||
|
@ -704,14 +705,14 @@ GS_NSURLComponents_IVARS;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
// Creating URL components...
|
// Creating URL components...
|
||||||
+ (instancetype) componentsWithString:(NSString *)URLString;
|
+ (instancetype) componentsWithString: (NSString *)URLString;
|
||||||
+ (instancetype) componentsWithURL:(NSURL *)url
|
+ (instancetype) componentsWithURL: (NSURL *)url
|
||||||
resolvingAgainstBaseURL:(BOOL)resolve;
|
resolvingAgainstBaseURL: (BOOL)resolve;
|
||||||
- (instancetype) init;
|
- (instancetype) init;
|
||||||
- (instancetype)initWithString:(NSString *)URLString;
|
- (instancetype) initWithString: (NSString *)URLString;
|
||||||
|
|
||||||
- (instancetype)initWithURL:(NSURL *)url
|
- (instancetype) initWithURL: (NSURL *)url
|
||||||
resolvingAgainstBaseURL:(BOOL)resolve;
|
resolvingAgainstBaseURL: (BOOL)resolve;
|
||||||
|
|
||||||
// Getting the URL
|
// Getting the URL
|
||||||
- (NSString *) string;
|
- (NSString *) string;
|
||||||
|
|
|
@ -657,33 +657,33 @@ static NSUInteger urlAlign;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (id) initFileURLWithPath: (NSString *)aPath
|
- (id) initFileURLWithPath: (NSString *)aPath
|
||||||
isDirectory: (BOOL)isDir
|
isDirectory: (BOOL)isDir
|
||||||
relativeToURL: (NSURL *)baseURL
|
relativeToURL: (NSURL *)baseURL
|
||||||
{
|
{
|
||||||
NSFileManager *mgr = [NSFileManager defaultManager];
|
NSFileManager *mgr = [NSFileManager defaultManager];
|
||||||
BOOL flag = NO;
|
BOOL flag = NO;
|
||||||
|
|
||||||
if (nil == aPath)
|
if (nil == aPath)
|
||||||
{
|
{
|
||||||
[NSException
|
[NSException raise: NSInvalidArgumentException
|
||||||
raise:NSInvalidArgumentException
|
format: @"[%@ %@] nil string parameter",
|
||||||
format:@"[%@ %@] nil string parameter", NSStringFromClass([self class]),
|
NSStringFromClass([self class]), NSStringFromSelector(_cmd)];
|
||||||
NSStringFromSelector(_cmd)];
|
|
||||||
}
|
}
|
||||||
if ([aPath isAbsolutePath] == NO)
|
if ([aPath isAbsolutePath] == NO)
|
||||||
{
|
{
|
||||||
if (baseURL)
|
if (baseURL)
|
||||||
{
|
{
|
||||||
/* Append aPath to baseURL */
|
/* Append aPath to baseURL */
|
||||||
aPath = [[baseURL relativePath] stringByAppendingPathComponent:aPath];
|
aPath
|
||||||
|
= [[baseURL relativePath] stringByAppendingPathComponent: aPath];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
aPath =
|
aPath =
|
||||||
[[mgr currentDirectoryPath] stringByAppendingPathComponent:aPath];
|
[[mgr currentDirectoryPath] stringByAppendingPathComponent: aPath];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ([mgr fileExistsAtPath:aPath isDirectory:&flag] == YES)
|
if ([mgr fileExistsAtPath: aPath isDirectory: &flag] == YES)
|
||||||
{
|
{
|
||||||
if ([aPath isAbsolutePath] == NO)
|
if ([aPath isAbsolutePath] == NO)
|
||||||
{
|
{
|
||||||
|
@ -693,7 +693,7 @@ static NSUInteger urlAlign;
|
||||||
}
|
}
|
||||||
if (isDir == YES && [aPath hasSuffix:@"/"] == NO)
|
if (isDir == YES && [aPath hasSuffix:@"/"] == NO)
|
||||||
{
|
{
|
||||||
aPath = [aPath stringByAppendingString:@"/"];
|
aPath = [aPath stringByAppendingString: @"/"];
|
||||||
}
|
}
|
||||||
return [self initWithScheme: NSURLFileScheme host: @"" path: aPath];
|
return [self initWithScheme: NSURLFileScheme host: @"" path: aPath];
|
||||||
}
|
}
|
||||||
|
@ -1978,8 +1978,8 @@ static NSUInteger urlAlign;
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (NSURL *) URLByAppendingPathComponent:(NSString *)pathComponent
|
- (NSURL *) URLByAppendingPathComponent: (NSString *)pathComponent
|
||||||
isDirectory:(BOOL)isDirectory
|
isDirectory: (BOOL)isDirectory
|
||||||
{
|
{
|
||||||
NSString *path = [[self path] stringByAppendingPathComponent: pathComponent];
|
NSString *path = [[self path] stringByAppendingPathComponent: pathComponent];
|
||||||
if (isDirectory)
|
if (isDirectory)
|
||||||
|
@ -2146,8 +2146,8 @@ GS_PRIVATE_INTERNAL(NSURLQueryItem)
|
||||||
@implementation NSURLQueryItem
|
@implementation NSURLQueryItem
|
||||||
|
|
||||||
// Creating query items.
|
// Creating query items.
|
||||||
+ (instancetype)queryItemWithName:(NSString *)name
|
+ (instancetype)queryItemWithName: (NSString *)name
|
||||||
value:(NSString *)value
|
value: (NSString *)value
|
||||||
{
|
{
|
||||||
NSURLQueryItem *newQueryItem = [[NSURLQueryItem alloc] initWithName: name
|
NSURLQueryItem *newQueryItem = [[NSURLQueryItem alloc] initWithName: name
|
||||||
value: value];
|
value: value];
|
||||||
|
@ -2156,31 +2156,33 @@ GS_PRIVATE_INTERNAL(NSURLQueryItem)
|
||||||
|
|
||||||
- (instancetype) init
|
- (instancetype) init
|
||||||
{
|
{
|
||||||
self = [self initWithName:nil value:nil];
|
self = [self initWithName: nil value: nil];
|
||||||
if(self != nil)
|
if (self != nil)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (instancetype)initWithName:(NSString *)name
|
- (instancetype) initWithName: (NSString *)name
|
||||||
value:(NSString *)value
|
value: (NSString *)value
|
||||||
{
|
{
|
||||||
self = [super init];
|
self = [super init];
|
||||||
if(self != nil)
|
if (self != nil)
|
||||||
{
|
{
|
||||||
GS_CREATE_INTERNAL(NSURLQueryItem);
|
GS_CREATE_INTERNAL(NSURLQueryItem);
|
||||||
if(name)
|
if (name)
|
||||||
{
|
{
|
||||||
ASSIGNCOPY(internal->_name, name);
|
ASSIGNCOPY(internal->_name, name);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ASSIGN(internal->_name, @""); //OSX behaviour is to set an empty string for nil name property
|
/* OSX behaviour is to set an empty string for nil name property
|
||||||
}
|
*/
|
||||||
ASSIGNCOPY(internal->_value, value);
|
ASSIGN(internal->_name, @"");
|
||||||
}
|
}
|
||||||
|
ASSIGNCOPY(internal->_value, value);
|
||||||
|
}
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2310,11 +2312,13 @@ static NSCharacterSet *queryItemCharSet = nil;
|
||||||
|
|
||||||
- (instancetype) initWithString: (NSString *)URLString
|
- (instancetype) initWithString: (NSString *)URLString
|
||||||
{
|
{
|
||||||
//OSX behavior is to return nil for a string which cannot be used to initialize valid NSURL object
|
/* OSX behavior is to return nil for a string which cannot be
|
||||||
NSURL* url = [NSURL URLWithString:URLString];
|
* used to initialize valid NSURL object
|
||||||
if(url)
|
*/
|
||||||
|
NSURL *url = [NSURL URLWithString: URLString];
|
||||||
|
if (url)
|
||||||
{
|
{
|
||||||
return [self initWithURL:url resolvingAgainstBaseURL:NO];
|
return [self initWithURL: url resolvingAgainstBaseURL: NO];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue