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