1999-02-13 00:50:41 +00:00
|
|
|
/* NSURL.h - Class NSURL
|
|
|
|
Copyright (C) 1999 Free Software Foundation, Inc.
|
2021-08-17 10:30:19 +00:00
|
|
|
|
1999-07-15 05:43:49 +00:00
|
|
|
Written by: Manuel Guesdon <mguesdon@sbuilders.com>
|
2002-06-06 14:02:59 +00:00
|
|
|
Date: Jan 1999
|
2021-08-17 10:30:19 +00:00
|
|
|
|
1999-02-13 00:50:41 +00:00
|
|
|
This file is part of the GNUstep Library.
|
2021-08-17 10:30:19 +00:00
|
|
|
|
1999-02-13 00:50:41 +00:00
|
|
|
This library is free software; you can redistribute it and/or
|
2007-09-14 11:36:11 +00:00
|
|
|
modify it under the terms of the GNU Lesser General Public
|
1999-02-13 00:50:41 +00:00
|
|
|
License as published by the Free Software Foundation; either
|
2008-06-08 10:38:33 +00:00
|
|
|
version 2 of the License, or (at your option) any later version.
|
2021-08-17 10:30:19 +00:00
|
|
|
|
1999-02-13 00:50:41 +00:00
|
|
|
This library is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
2019-12-09 23:36:00 +00:00
|
|
|
Lesser General Public License for more details.
|
2021-08-17 10:30:19 +00:00
|
|
|
|
2007-09-14 11:36:11 +00:00
|
|
|
You should have received a copy of the GNU Lesser General Public
|
1999-02-13 00:50:41 +00:00
|
|
|
License along with this library; if not, write to the Free
|
2006-10-31 07:05:46 +00:00
|
|
|
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
2019-12-09 23:36:00 +00:00
|
|
|
Boston, MA 02110 USA.
|
1999-02-13 00:50:41 +00:00
|
|
|
*/
|
|
|
|
|
2006-10-31 07:05:46 +00:00
|
|
|
#ifndef __NSURL_h_GNUSTEP_BASE_INCLUDE
|
|
|
|
#define __NSURL_h_GNUSTEP_BASE_INCLUDE
|
2021-08-17 10:30:19 +00:00
|
|
|
#import <GNUstepBase/GSVersionMacros.h>
|
1999-07-15 05:43:49 +00:00
|
|
|
|
2021-08-17 10:30:19 +00:00
|
|
|
#import <Foundation/NSURLHandle.h>
|
2019-08-06 06:57:18 +00:00
|
|
|
#import <Foundation/NSRange.h>
|
1999-02-13 00:50:41 +00:00
|
|
|
|
2021-08-17 10:30:19 +00:00
|
|
|
#if defined(__cplusplus)
|
2006-09-13 10:20:49 +00:00
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2021-08-17 10:30:19 +00:00
|
|
|
#if OS_API_VERSION(GS_API_MACOSX, GS_API_LATEST)
|
2002-06-06 14:02:59 +00:00
|
|
|
|
2011-06-04 15:08:37 +00:00
|
|
|
@class NSError;
|
2001-11-24 15:47:59 +00:00
|
|
|
@class NSNumber;
|
2019-08-01 20:03:16 +00:00
|
|
|
@class NSString;
|
|
|
|
@class NSDictionary;
|
|
|
|
@class NSArray;
|
1999-02-13 00:50:41 +00:00
|
|
|
|
2004-07-29 15:30:47 +00:00
|
|
|
/**
|
|
|
|
* URL scheme constant for use with [NSURL-initWithScheme:host:path:].
|
|
|
|
*/
|
2021-08-17 10:30:19 +00:00
|
|
|
GS_EXPORT NSString *const NSURLFileScheme;
|
1999-02-13 00:50:41 +00:00
|
|
|
|
2017-06-21 20:42:49 +00:00
|
|
|
/** URL Bookmark Resolution Options **/
|
|
|
|
#if OS_API_VERSION(MAC_OS_X_VERSION_10_6, GS_API_LATEST)
|
|
|
|
typedef NSUInteger NSURLBookmarkResolutionOptions;
|
|
|
|
enum
|
|
|
|
{
|
|
|
|
NSURLBookmarkResolutionWithoutUI = (1 << 8),
|
|
|
|
NSURLBookmarkResolutionWithoutMounting = (1 << 9),
|
|
|
|
#if OS_API_VERSION(MAC_OS_X_VERSION_10_7, GS_API_LATEST)
|
|
|
|
NSURLBookmarkResolutionWithSecurityScope = (1 << 10)
|
|
|
|
#endif
|
|
|
|
};
|
|
|
|
#endif
|
|
|
|
|
2011-06-17 11:45:28 +00:00
|
|
|
/**
|
|
|
|
* This class permits manipulation of URLs and the resources to which they
|
|
|
|
* refer. They can be used to represent absolute URLs or relative URLs
|
|
|
|
* which are based upon an absolute URL. The relevant RFCs describing
|
|
|
|
* how a URL is formatted, and what is legal in a URL are -
|
|
|
|
* 1808, 1738, and 2396.<br />
|
|
|
|
* Handling of the underlying resources is carried out by NSURLHandle
|
|
|
|
* objects, but NSURL provides a simplified API wrapping these objects.
|
|
|
|
*/
|
2021-01-18 13:20:14 +00:00
|
|
|
GS_EXPORT_CLASS
|
2021-08-17 10:30:19 +00:00
|
|
|
@interface NSURL : NSObject <NSCoding, NSCopying, NSURLHandleClient>
|
1999-02-13 00:50:41 +00:00
|
|
|
{
|
2021-08-17 10:30:19 +00:00
|
|
|
#if GS_EXPOSE(NSURL)
|
2010-02-14 10:48:10 +00:00
|
|
|
@private
|
2021-08-17 10:30:19 +00:00
|
|
|
NSString *_urlString;
|
|
|
|
NSURL * _baseURL;
|
|
|
|
void * _clients;
|
|
|
|
void * _data;
|
2010-02-14 10:48:10 +00:00
|
|
|
#endif
|
1999-07-15 05:43:49 +00:00
|
|
|
}
|
2021-08-17 10:30:19 +00:00
|
|
|
|
2011-06-17 11:45:28 +00:00
|
|
|
/**
|
|
|
|
* Create and return a file URL with the supplied path.<br />
|
|
|
|
* The value of aPath must be a valid filesystem path.<br />
|
|
|
|
* Calls -initFileURLWithPath: which escapes characters in the
|
|
|
|
* path where necessary.
|
|
|
|
*/
|
2021-08-17 10:30:19 +00:00
|
|
|
+ (instancetype)fileURLWithPath:(NSString *)aPath;
|
2011-06-17 11:45:28 +00:00
|
|
|
|
2021-08-17 10:30:19 +00:00
|
|
|
#if OS_API_VERSION(MAC_OS_X_VERSION_10_5, GS_API_LATEST)
|
|
|
|
|
|
|
|
+ (instancetype)fileURLWithPath:(NSString *)aPath isDirectory:(BOOL)isDir;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if OS_API_VERSION(MAC_OS_X_VERSION_10_11, GS_API_LATEST)
|
|
|
|
+ (instancetype)fileURLWithPath:(NSString *)aPath
|
|
|
|
isDirectory:(BOOL)isDir
|
|
|
|
relativeToURL:(NSURL *)baseURL;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if OS_API_VERSION(MAC_OS_X_VERSION_10_11, GS_API_LATEST)
|
|
|
|
/** Create and return a file URL with the supplied path, relative to a base URL.
|
2011-06-18 07:09:28 +00:00
|
|
|
*/
|
2021-08-17 10:30:19 +00:00
|
|
|
+ (instancetype)fileURLWithPath:(NSString *)aPath relativeToURL:(NSURL *)baseURL;
|
2011-06-18 07:09:28 +00:00
|
|
|
#endif
|
|
|
|
|
2021-08-17 10:30:19 +00:00
|
|
|
#if OS_API_VERSION(MAC_OS_X_VERSION_10_6, GS_API_LATEST)
|
|
|
|
/** Creates a file URL using a path built from components.
|
|
|
|
*/
|
|
|
|
+ (instancetype)fileURLWithPathComponents:(NSArray *)components;
|
2017-06-21 20:41:10 +00:00
|
|
|
#endif
|
2021-08-17 10:30:19 +00:00
|
|
|
|
2011-06-17 11:45:28 +00:00
|
|
|
/**
|
|
|
|
* Create and return a URL with the supplied string, which should
|
|
|
|
* be a string (containing percent escape codes where necessary)
|
|
|
|
* conforming to the description (in RFC2396) of an absolute URL.<br />
|
|
|
|
* Calls -initWithString:
|
|
|
|
*/
|
2021-08-17 10:30:19 +00:00
|
|
|
+ (instancetype)URLWithString:(NSString *)aUrlString;
|
2011-06-17 11:45:28 +00:00
|
|
|
|
2017-06-21 20:42:49 +00:00
|
|
|
#if OS_API_VERSION(MAC_OS_X_VERSION_10_10, GS_API_LATEST)
|
2021-08-17 10:30:19 +00:00
|
|
|
+ (instancetype)URLByResolvingAliasFileAtURL:(NSURL *)url
|
|
|
|
options:
|
|
|
|
(NSURLBookmarkResolutionOptions)options
|
|
|
|
error:(NSError **)error;
|
2017-06-21 20:42:49 +00:00
|
|
|
#endif
|
|
|
|
|
2011-06-17 11:45:28 +00:00
|
|
|
/**
|
|
|
|
* Create and return a URL with the supplied string, which should
|
|
|
|
* be a string (containing percent escape codes where necessary)
|
|
|
|
* conforming to the description (in RFC2396) of a relative URL.<br />
|
|
|
|
* Calls -initWithString:relativeToURL:
|
|
|
|
*/
|
2021-08-17 10:30:19 +00:00
|
|
|
+ (instancetype)URLWithString:(NSString *)aUrlString
|
|
|
|
relativeToURL:(NSURL *)aBaseUrl;
|
1999-02-13 00:50:41 +00:00
|
|
|
|
2011-06-17 11:45:28 +00:00
|
|
|
/**
|
|
|
|
* Initialise as a file URL with the specified path (which must
|
|
|
|
* be a valid path on the local filesystem).<br />
|
2011-10-04 05:40:29 +00:00
|
|
|
* Raises NSInvalidArgumentException if aPath is nil.<br />
|
2011-06-17 11:45:28 +00:00
|
|
|
* Converts relative paths to absolute ones.<br />
|
|
|
|
* Appends a trailing slash to the path when necessary if it
|
|
|
|
* specifies a directory.<br />
|
|
|
|
* Calls -initWithScheme:host:path:
|
|
|
|
*/
|
2021-08-17 10:30:19 +00:00
|
|
|
- (instancetype)initFileURLWithPath:(NSString *)aPath;
|
2011-06-17 11:45:28 +00:00
|
|
|
|
2021-08-17 10:30:19 +00:00
|
|
|
#if OS_API_VERSION(MAC_OS_X_VERSION_10_5, GS_API_LATEST)
|
2011-06-17 13:47:24 +00:00
|
|
|
/**
|
|
|
|
* Initialise as a file URL with the specified path (which must
|
|
|
|
* be a valid path on the local filesystem).<br />
|
2011-10-04 05:40:29 +00:00
|
|
|
* Raises NSInvalidArgumentException if aPath is nil.<br />
|
2011-06-17 13:47:24 +00:00
|
|
|
* Converts relative paths to absolute ones.<br />
|
|
|
|
* Appends a trailing slash to the path when necessary if it
|
|
|
|
* specifies a directory.<br />
|
|
|
|
* Calls -initWithScheme:host:path:
|
|
|
|
*/
|
2021-08-17 10:30:19 +00:00
|
|
|
- (instancetype)initFileURLWithPath:(NSString *)aPath isDirectory:(BOOL)isDir;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if OS_API_VERSION(MAC_OS_X_VERSION_10_11, GS_API_LATEST)
|
|
|
|
/**
|
|
|
|
* Initialise as a file URL with the specified path (which must
|
|
|
|
* be a valid path on the local filesystem) relative to the base URL.<br />
|
|
|
|
* Raises NSInvalidArgumentException if aPath is nil.<br />
|
|
|
|
* Converts relative paths to absolute ones.<br />
|
|
|
|
* Appends a trailing slash to the path when necessary if it
|
|
|
|
* specifies a directory.<br />
|
|
|
|
* Calls -initWithScheme:host:path:
|
|
|
|
*/
|
|
|
|
- (instancetype)initFileURLWithPath:(NSString *)aPath
|
|
|
|
relativeToURL:(NSURL *)baseURL;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if OS_API_VERSION(MAC_OS_X_VERSION_10_11, GS_API_LATEST)
|
|
|
|
/**
|
|
|
|
* Initialise as a file URL with the specified path (which must
|
|
|
|
* be a valid path on the local filesystem) relative to the base URL.<br />
|
|
|
|
* Raises NSInvalidArgumentException if aPath is nil.<br />
|
|
|
|
* Converts relative paths to absolute ones.<br />
|
|
|
|
* Appends a trailing slash to the path when necessary if it
|
|
|
|
* specifies a directory.<br />
|
|
|
|
* Calls -initWithScheme:host:path:
|
|
|
|
*/
|
|
|
|
- (instancetype)initFileURLWithPath:(NSString *)aPath
|
|
|
|
isDirectory:(BOOL)isDir
|
|
|
|
relativeToURL:(NSURL *)baseURL;
|
2011-06-17 13:47:24 +00:00
|
|
|
#endif
|
|
|
|
|
2011-06-17 11:45:28 +00:00
|
|
|
/**
|
|
|
|
* Initialise by building a URL string from the supplied parameters
|
|
|
|
* and calling -initWithString:relativeToURL:<br />
|
|
|
|
* This method adds percent escapes to aPath if it contains characters
|
|
|
|
* which need escaping.<br />
|
|
|
|
* Accepts RFC2732 style IPv6 host addresses either with or without the
|
|
|
|
* enclosing square brackets (MacOS-X at least up to version 10.5 does
|
|
|
|
* not handle these correctly, but GNUstep does).<br />
|
|
|
|
* Permits the 'aHost' part to contain 'username:password@host:port' or
|
|
|
|
* 'host:port' in addition to a simple host name or address.
|
|
|
|
*/
|
2021-08-17 10:30:19 +00:00
|
|
|
- (instancetype)initWithScheme:(NSString *)aScheme
|
|
|
|
host:(NSString *)aHost
|
|
|
|
path:(NSString *)aPath;
|
2011-06-17 11:45:28 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Initialise as an absolute URL.<br />
|
|
|
|
* Calls -initWithString:relativeToURL:
|
|
|
|
*/
|
2021-08-17 10:30:19 +00:00
|
|
|
- (instancetype)initWithString:(NSString *)aUrlString;
|
2011-06-17 11:45:28 +00:00
|
|
|
|
|
|
|
/** <init />
|
|
|
|
* Initialised using aUrlString and aBaseUrl. The value of aBaseUrl
|
|
|
|
* may be nil, but aUrlString must be non-nil.<br />
|
|
|
|
* Accepts RFC2732 style IPv6 host addresses.<br />
|
|
|
|
* Parses a string wihthout a scheme as a simple path.<br />
|
|
|
|
* Parses an empty string as an empty path.<br />
|
|
|
|
* If the string cannot be parsed the method returns nil.
|
|
|
|
*/
|
2021-08-17 10:30:19 +00:00
|
|
|
- (instancetype)initWithString:(NSString *)aUrlString
|
|
|
|
relativeToURL:(NSURL *)aBaseUrl;
|
1999-02-13 00:50:41 +00:00
|
|
|
|
2017-06-21 20:43:51 +00:00
|
|
|
#if GS_HAS_DECLARED_PROPERTIES
|
|
|
|
@property (readonly, getter=isFileURL) BOOL fileURL;
|
|
|
|
#else
|
2021-08-17 10:30:19 +00:00
|
|
|
- (BOOL)isFileURL;
|
2017-06-21 20:43:51 +00:00
|
|
|
#endif
|
|
|
|
|
2011-06-17 11:45:28 +00:00
|
|
|
/**
|
|
|
|
* Returns the full string describing the receiver resolved against its base.
|
|
|
|
*/
|
2021-08-17 10:30:19 +00:00
|
|
|
- (NSString *)absoluteString;
|
2011-06-17 11:45:28 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* If the receiver is an absolute URL, returns self. Otherwise returns an
|
|
|
|
* absolute URL referring to the same resource as the receiver.
|
|
|
|
*/
|
2021-08-17 10:30:19 +00:00
|
|
|
- (NSURL *)absoluteURL;
|
2011-06-17 11:45:28 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* If the receiver is a relative URL, returns its base URL.<br />
|
|
|
|
* Otherwise, returns nil.
|
|
|
|
*/
|
2021-08-17 10:30:19 +00:00
|
|
|
- (NSURL *)baseURL;
|
2011-06-17 11:45:28 +00:00
|
|
|
|
2021-08-17 10:30:19 +00:00
|
|
|
#if OS_API_VERSION(MAC_OS_X_VERSION_10_6, GS_API_LATEST)
|
2011-06-17 11:45:28 +00:00
|
|
|
/** Attempts to load from the specified URL and provides an error
|
|
|
|
* response if the data is unrachable.<br />
|
|
|
|
* Returns YES on success, NO on failure.
|
|
|
|
*/
|
2021-08-17 10:30:19 +00:00
|
|
|
- (BOOL)checkResourceIsReachableAndReturnError:(NSError **)error;
|
2011-06-04 15:08:37 +00:00
|
|
|
#endif
|
2011-06-17 11:45:28 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns the fragment portion of the receiver or nil if there is no
|
|
|
|
* fragment supplied in the URL.<br />
|
|
|
|
* The fragment is everything in the original URL string after a '#'<br />
|
|
|
|
* File URLs do not have fragments.
|
|
|
|
*/
|
2021-08-17 10:30:19 +00:00
|
|
|
- (NSString *)fragment;
|
2011-06-17 11:45:28 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns the host portion of the receiver or nil if there is no
|
|
|
|
* host supplied in the URL.<br />
|
|
|
|
* Percent escape sequences in the user string are translated and the string
|
|
|
|
* treated as UTF8.<br />
|
|
|
|
* Returns IPv6 addresses <em>without</em> the enclosing square brackets
|
|
|
|
* required (by RFC2732) in URL strings.
|
|
|
|
*/
|
2021-08-17 10:30:19 +00:00
|
|
|
- (NSString *)host;
|
2011-06-17 11:45:28 +00:00
|
|
|
|
2021-08-17 10:30:19 +00:00
|
|
|
#if OS_API_VERSION(MAC_OS_X_VERSION_10_6, GS_API_LATEST)
|
2011-06-17 11:45:28 +00:00
|
|
|
/** Returns the last (rightmost) path component of the receiver.
|
|
|
|
*/
|
2021-08-17 10:30:19 +00:00
|
|
|
- (NSString *)lastPathComponent;
|
2011-06-17 11:45:28 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Loads resource data for the specified client.
|
|
|
|
* <p>
|
|
|
|
* If shouldUseCache is YES then an attempt
|
|
|
|
* will be made to locate a cached NSURLHandle to provide the
|
|
|
|
* resource data, otherwise a new handle will be created and
|
|
|
|
* cached.
|
|
|
|
* </p>
|
|
|
|
* <p>
|
|
|
|
* If the handle does not have the data available, it will be
|
|
|
|
* asked to load the data in the background by calling its
|
|
|
|
* loadInBackground method.
|
|
|
|
* </p>
|
|
|
|
* <p>
|
|
|
|
* The specified client (if non-nil) will be set up to receive
|
|
|
|
* notifications of the progress of the background load process.
|
|
|
|
* </p>
|
|
|
|
* <p>
|
|
|
|
* The processes current run loop must be run in order for the
|
|
|
|
* background load operation to operate!
|
|
|
|
* </p>
|
|
|
|
*/
|
2021-08-17 10:30:19 +00:00
|
|
|
- (void)loadResourceDataNotifyingClient:(id)client
|
|
|
|
usingCache:(BOOL)shouldUseCache;
|
2011-06-17 11:45:28 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns the parameter portion of the receiver or nil if there is no
|
|
|
|
* parameter supplied in the URL.<br />
|
|
|
|
* The parameters are everything in the original URL string after a ';'
|
|
|
|
* but before the query.<br />
|
|
|
|
* File URLs do not have parameters.
|
|
|
|
*/
|
2021-08-17 10:30:19 +00:00
|
|
|
- (NSString *)parameterString;
|
2011-06-17 11:45:28 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns the password portion of the receiver or nil if there is no
|
|
|
|
* password supplied in the URL.<br />
|
|
|
|
* Percent escape sequences in the user string are translated and the string
|
|
|
|
* treated as UTF8 in GNUstep but this appears to be broken in MacOS-X.<br />
|
|
|
|
* NB. because of its security implications it is recommended that you
|
|
|
|
* do not use URLs with users and passwords unless necessary.
|
|
|
|
*/
|
2021-08-17 10:30:19 +00:00
|
|
|
- (NSString *)password;
|
2011-06-17 11:45:28 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns the path portion of the receiver.<br />
|
|
|
|
* Replaces percent escapes with unescaped values, interpreting non-ascii
|
|
|
|
* character sequences as UTF8.<br />
|
|
|
|
* NB. This does not conform strictly to the RFCs, in that it includes a
|
|
|
|
* leading slash ('/') character (whereas the path part of a URL strictly
|
|
|
|
* should not) and the interpretation of non-ascii character is (strictly
|
|
|
|
* speaking) undefined.<br />
|
|
|
|
* Also, this breaks strict conformance in that a URL of file scheme is
|
|
|
|
* treated as having a path (contrary to RFCs)
|
|
|
|
*/
|
2021-08-17 10:30:19 +00:00
|
|
|
- (NSString *)path;
|
2011-06-17 11:45:28 +00:00
|
|
|
|
2021-08-17 10:30:19 +00:00
|
|
|
#if OS_API_VERSION(MAC_OS_X_VERSION_10_6, GS_API_LATEST)
|
2011-06-18 07:09:28 +00:00
|
|
|
/** Returns thepath components of the receiver.<br />
|
|
|
|
* See [NSString-pathComponents].
|
|
|
|
*/
|
2021-08-17 10:30:19 +00:00
|
|
|
- (NSArray *)pathComponents;
|
2011-06-18 07:09:28 +00:00
|
|
|
|
2011-06-17 11:45:28 +00:00
|
|
|
/** Returns the file extension (text after the rightmost dot in the path)
|
2011-06-18 07:09:28 +00:00
|
|
|
* of the receiver.<br />
|
|
|
|
* see [NSString-pathExtension].
|
2011-06-17 11:45:28 +00:00
|
|
|
*/
|
2021-08-17 10:30:19 +00:00
|
|
|
- (NSString *)pathExtension;
|
2011-06-17 11:45:28 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns the port portion of the receiver or nil if there is no
|
|
|
|
* port supplied in the URL.<br />
|
|
|
|
* Percent escape sequences in the user string are translated in GNUstep
|
|
|
|
* but this appears to be broken in MacOS-X.
|
|
|
|
*/
|
2021-08-17 10:30:19 +00:00
|
|
|
- (NSNumber *)port;
|
2011-06-17 11:45:28 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Asks a URL handle to return the property for the specified key and
|
|
|
|
* returns the result.
|
|
|
|
*/
|
2021-08-17 10:30:19 +00:00
|
|
|
- (id)propertyForKey:(NSString *)propertyKey;
|
2011-06-17 11:45:28 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns the query portion of the receiver or nil if there is no
|
|
|
|
* query supplied in the URL.<br />
|
|
|
|
* The query is everything in the original URL string after a '?'
|
|
|
|
* but before the fragment.<br />
|
|
|
|
* File URLs do not have queries.
|
|
|
|
*/
|
2021-08-17 10:30:19 +00:00
|
|
|
- (NSString *)query;
|
2011-06-17 11:45:28 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns the path of the receiver, without taking any base URL into account.
|
|
|
|
* If the receiver is an absolute URL, -relativePath is the same as -path.<br />
|
|
|
|
* Returns nil if there is no path specified for the URL.
|
|
|
|
*/
|
2021-08-17 10:30:19 +00:00
|
|
|
- (NSString *)relativePath;
|
2011-06-17 11:45:28 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns the relative portion of the URL string. If the receiver is not
|
|
|
|
* a relative URL, this returns the same as absoluteString.
|
|
|
|
*/
|
2021-08-17 10:30:19 +00:00
|
|
|
- (NSString *)relativeString;
|
2011-06-17 11:45:28 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Loads the resource data for the represented URL and returns the result.
|
|
|
|
* The shouldUseCache flag determines whether data previously retrieved by
|
|
|
|
* an existing NSURLHandle can be used to provide the data, or if it should
|
|
|
|
* be refetched.
|
|
|
|
*/
|
2021-08-17 10:30:19 +00:00
|
|
|
- (NSData *)resourceDataUsingCache:(BOOL)shouldUseCache;
|
2011-06-17 11:45:28 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns the resource specifier of the URL ... the part which lies
|
|
|
|
* after the scheme.
|
|
|
|
*/
|
2021-08-17 10:30:19 +00:00
|
|
|
- (NSString *)resourceSpecifier;
|
2011-06-17 11:45:28 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns the scheme of the receiver.
|
|
|
|
*/
|
2021-08-17 10:30:19 +00:00
|
|
|
- (NSString *)scheme;
|
2011-06-17 11:45:28 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Calls [NSURLHandle-writeProperty:forKey:] to set the named property.
|
|
|
|
*/
|
2021-08-17 10:30:19 +00:00
|
|
|
- (BOOL)setProperty:(id)property forKey:(NSString *)propertyKey;
|
2011-06-17 11:45:28 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Calls [NSURLHandle-writeData:] to write the specified data object
|
|
|
|
* to the resource identified by the receiver URL.<br />
|
|
|
|
* Returns the result.
|
|
|
|
*/
|
2021-08-17 10:30:19 +00:00
|
|
|
- (BOOL)setResourceData:(NSData *)data;
|
2011-06-17 11:45:28 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns a URL with '/./' and '/../' sequences resolved etc.
|
|
|
|
*/
|
2021-08-17 10:30:19 +00:00
|
|
|
- (NSURL *)standardizedURL;
|
2011-06-17 11:45:28 +00:00
|
|
|
|
2021-08-17 10:30:19 +00:00
|
|
|
#if OS_API_VERSION(MAC_OS_X_VERSION_10_6, GS_API_LATEST)
|
2011-06-17 11:45:28 +00:00
|
|
|
/** Returns a URL formed by adding a path component to the path of the
|
2011-06-18 07:09:28 +00:00
|
|
|
* receiver.<br />
|
|
|
|
* See [NSString-stringByAppendingPathComponent:].
|
2011-06-17 11:45:28 +00:00
|
|
|
*/
|
2021-08-17 10:30:19 +00:00
|
|
|
- (NSURL *)URLByAppendingPathComponent:(NSString *)pathComponent;
|
2011-06-17 11:45:28 +00:00
|
|
|
|
|
|
|
/** Returns a URL formed by adding a path extension to the path of the
|
2011-06-18 07:09:28 +00:00
|
|
|
* receiver.<br />
|
|
|
|
* See [NSString-stringByAppendingPathExtension:].
|
2011-06-17 11:45:28 +00:00
|
|
|
*/
|
2021-08-17 10:30:19 +00:00
|
|
|
- (NSURL *)URLByAppendingPathExtension:(NSString *)pathExtension;
|
2011-06-17 11:45:28 +00:00
|
|
|
|
|
|
|
/** Returns a URL formed by removing a path component from the path of the
|
2011-06-18 07:09:28 +00:00
|
|
|
* receiver.<br />
|
|
|
|
* See [NSString-stringByDeletingLastPathComponent].
|
2011-06-17 11:45:28 +00:00
|
|
|
*/
|
2021-08-17 10:30:19 +00:00
|
|
|
- (NSURL *)URLByDeletingLastPathComponent;
|
2011-06-17 11:45:28 +00:00
|
|
|
|
|
|
|
/** Returns a URL formed by removing an extension from the path of the
|
2011-06-18 07:09:28 +00:00
|
|
|
* receiver.<br />
|
|
|
|
* See [NSString-stringByDeletingPathExtension].
|
2011-06-17 11:45:28 +00:00
|
|
|
*/
|
2021-08-17 10:30:19 +00:00
|
|
|
- (NSURL *)URLByDeletingPathExtension;
|
2011-06-18 07:09:28 +00:00
|
|
|
|
|
|
|
/** Returns self unless the receiver is a file URL, in which case it returns
|
|
|
|
* a URL formed by calling [NSString-stringByResolvingSymlinksInPath].
|
|
|
|
*/
|
2021-08-17 10:30:19 +00:00
|
|
|
- (NSURL *)URLByResolvingSymlinksInPath;
|
2011-06-18 07:09:28 +00:00
|
|
|
|
|
|
|
/** Returns self unless the receiver is a file URL, in which case it returns
|
|
|
|
* a URL formed by calling [NSString-stringByStandardizingPath].
|
|
|
|
*/
|
2021-08-17 10:30:19 +00:00
|
|
|
- (NSURL *)URLByStandardizingPath;
|
2011-06-18 07:09:28 +00:00
|
|
|
|
2011-06-17 11:45:28 +00:00
|
|
|
#endif
|
|
|
|
|
2021-08-17 10:30:19 +00:00
|
|
|
#if OS_API_VERSION(MAC_OS_X_VERSION_10_7, GS_API_LATEST)
|
2020-08-03 11:03:21 +00:00
|
|
|
/** Returns a URL formed by adding a path component to the path of the
|
|
|
|
* receiver, along with a trailing slash if the component is designated a
|
|
|
|
* directory.<br />
|
|
|
|
* See [NSString-stringByAppendingPathComponent:].
|
|
|
|
*/
|
2021-08-17 10:30:19 +00:00
|
|
|
- (NSURL *)URLByAppendingPathComponent:(NSString *)pathComponent
|
|
|
|
isDirectory:(BOOL)isDirectory;
|
2020-08-03 11:03:21 +00:00
|
|
|
#endif
|
|
|
|
|
2017-06-21 20:44:40 +00:00
|
|
|
#if OS_API_VERSION(MAC_OS_X_VERSION_10_6, GS_API_LATEST)
|
2021-08-17 10:30:19 +00:00
|
|
|
- (BOOL)isFileReferenceURL;
|
2020-08-03 11:03:21 +00:00
|
|
|
|
2021-08-17 10:30:19 +00:00
|
|
|
- (NSURL *)fileReferenceURL;
|
2020-08-03 11:03:21 +00:00
|
|
|
|
2021-08-17 10:30:19 +00:00
|
|
|
- (NSURL *)filePathURL;
|
2020-08-03 11:03:21 +00:00
|
|
|
|
2021-08-17 10:30:19 +00:00
|
|
|
- (BOOL)getResourceValue:(id *)value
|
|
|
|
forKey:(NSString *)key
|
|
|
|
error:(NSError **)error;
|
2017-06-21 20:44:40 +00:00
|
|
|
#endif
|
2011-06-17 11:45:28 +00:00
|
|
|
/**
|
|
|
|
* Returns an NSURLHandle instance which may be used to write data to the
|
|
|
|
* resource represented by the receiver URL, or read data from it.<br />
|
|
|
|
* The shouldUseCache flag indicates whether a cached handle may be returned
|
|
|
|
* or a new one should be created.
|
|
|
|
*/
|
2021-08-17 10:30:19 +00:00
|
|
|
- (NSURLHandle *)URLHandleUsingCache:(BOOL)shouldUseCache;
|
2011-06-17 11:45:28 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns the user portion of the receiver or nil if there is no
|
|
|
|
* user supplied in the URL.<br />
|
|
|
|
* Percent escape sequences in the user string are translated and
|
|
|
|
* the whole is treated as UTF8 data.<br />
|
|
|
|
* NB. because of its security implications it is recommended that you
|
|
|
|
* do not use URLs with users and passwords unless necessary.
|
|
|
|
*/
|
2021-08-17 10:30:19 +00:00
|
|
|
- (NSString *)user;
|
1999-02-13 00:50:41 +00:00
|
|
|
|
|
|
|
@end
|
|
|
|
|
|
|
|
@interface NSObject (NSURLClient)
|
2004-06-22 22:27:39 +00:00
|
|
|
|
2005-11-28 15:41:35 +00:00
|
|
|
/** <override-dummy />
|
2004-06-22 22:27:39 +00:00
|
|
|
* Some data has become available. Note that this does not mean that all data
|
|
|
|
* has become available, only that a chunk of data has arrived.
|
|
|
|
*/
|
2021-08-17 10:30:19 +00:00
|
|
|
- (void)URL:(NSURL *)sender resourceDataDidBecomeAvailable:(NSData *)newBytes;
|
1999-02-13 00:50:41 +00:00
|
|
|
|
2005-11-28 15:41:35 +00:00
|
|
|
/** <override-dummy />
|
2004-06-22 22:27:39 +00:00
|
|
|
* Loading of resource data is complete.
|
|
|
|
*/
|
2021-08-17 10:30:19 +00:00
|
|
|
- (void)URLResourceDidFinishLoading:(NSURL *)sender;
|
2004-06-22 22:27:39 +00:00
|
|
|
|
2005-11-28 15:41:35 +00:00
|
|
|
/** <override-dummy />
|
2005-11-06 13:53:40 +00:00
|
|
|
* Loading of resource data was cancelled by programmatic request
|
|
|
|
* (not an error).
|
2004-06-22 22:27:39 +00:00
|
|
|
*/
|
2021-08-17 10:30:19 +00:00
|
|
|
- (void)URLResourceDidCancelLoading:(NSURL *)sender;
|
1999-02-13 00:50:41 +00:00
|
|
|
|
2005-11-28 15:41:35 +00:00
|
|
|
/** <override-dummy />
|
2004-06-22 22:27:39 +00:00
|
|
|
* Loading of resource data has failed, for given human-readable reason.
|
|
|
|
*/
|
2021-08-17 10:30:19 +00:00
|
|
|
- (void)URL:(NSURL *)sender resourceDidFailLoadingWithReason:(NSString *)reason;
|
1999-02-13 00:50:41 +00:00
|
|
|
@end
|
|
|
|
|
2017-06-21 20:44:40 +00:00
|
|
|
/** URL Resource Value Constants **/
|
|
|
|
#if OS_API_VERSION(MAC_OS_X_VERSION_10_6, GS_API_LATEST)
|
2021-08-17 10:30:19 +00:00
|
|
|
GS_EXPORT NSString *const NSURLNameKey;
|
|
|
|
GS_EXPORT NSString *const NSURLLocalizedNameKey;
|
|
|
|
GS_EXPORT NSString *const NSURLIsRegularFileKey;
|
|
|
|
GS_EXPORT NSString *const NSURLIsDirectoryKey;
|
|
|
|
GS_EXPORT NSString *const NSURLIsSymbolicLinkKey;
|
|
|
|
GS_EXPORT NSString *const NSURLIsVolumeKey;
|
|
|
|
GS_EXPORT NSString *const NSURLIsPackageKey;
|
|
|
|
GS_EXPORT NSString *const NSURLIsSystemImmutableKey;
|
|
|
|
GS_EXPORT NSString *const NSURLIsUserImmutableKey;
|
|
|
|
GS_EXPORT NSString *const NSURLIsHiddenKey;
|
|
|
|
GS_EXPORT NSString *const NSURLHasHiddenExtensionKey;
|
|
|
|
GS_EXPORT NSString *const NSURLCreationDateKey;
|
|
|
|
GS_EXPORT NSString *const NSURLContentAccessDateKey;
|
|
|
|
GS_EXPORT NSString *const NSURLContentModificationDateKey;
|
|
|
|
GS_EXPORT NSString *const NSURLAttributeModificationDateKey;
|
|
|
|
GS_EXPORT NSString *const NSURLLinkCountKey;
|
|
|
|
GS_EXPORT NSString *const NSURLParentDirectoryURLKey;
|
|
|
|
GS_EXPORT NSString *const NSURLVolumeURLKey;
|
|
|
|
GS_EXPORT NSString *const NSURLTypeIdentifierKey;
|
|
|
|
GS_EXPORT NSString *const NSURLLocalizedTypeDescriptionKey;
|
|
|
|
GS_EXPORT NSString *const NSURLLabelNumberKey;
|
|
|
|
GS_EXPORT NSString *const NSURLLabelColorKey;
|
|
|
|
GS_EXPORT NSString *const NSURLLocalizedLabelKey;
|
|
|
|
GS_EXPORT NSString *const NSURLEffectiveIconKey;
|
|
|
|
GS_EXPORT NSString *const NSURLCustomIconKey;
|
|
|
|
GS_EXPORT NSString *const NSURLFileSizeKey;
|
|
|
|
GS_EXPORT NSString *const NSURLFileAllocatedSizeKey;
|
|
|
|
GS_EXPORT NSString *const NSURLIsAliasFileKey;
|
|
|
|
GS_EXPORT NSString *const NSURLVolumeLocalizedFormatDescriptionKey;
|
|
|
|
GS_EXPORT NSString *const NSURLVolumeTotalCapacityKey;
|
|
|
|
GS_EXPORT NSString *const NSURLVolumeAvailableCapacityKey;
|
|
|
|
GS_EXPORT NSString *const NSURLVolumeResourceCountKey;
|
|
|
|
GS_EXPORT NSString *const NSURLVolumeSupportsPersistentIDsKey;
|
|
|
|
GS_EXPORT NSString *const NSURLVolumeSupportsSymbolicLinksKey;
|
|
|
|
GS_EXPORT NSString *const NSURLVolumeSupportsHardLinksKey;
|
|
|
|
GS_EXPORT NSString *const NSURLVolumeSupportsJournalingKey;
|
|
|
|
GS_EXPORT NSString *const NSURLVolumeIsJournalingKey;
|
|
|
|
GS_EXPORT NSString *const NSURLVolumeSupportsSparseFilesKey;
|
|
|
|
GS_EXPORT NSString *const NSURLVolumeSupportsZeroRunsKey;
|
|
|
|
GS_EXPORT NSString *const NSURLVolumeSupportsCaseSensitiveNamesKey;
|
|
|
|
GS_EXPORT NSString *const NSURLVolumeSupportsCasePreservedNamesKey;
|
2017-06-21 20:44:40 +00:00
|
|
|
#endif
|
|
|
|
#if OS_API_VERSION(MAC_OS_X_VERSION_10_7, GS_API_LATEST)
|
2021-08-17 10:30:19 +00:00
|
|
|
GS_EXPORT NSString *const NSURLFileResourceIdentifierKey;
|
|
|
|
GS_EXPORT NSString *const NSURLVolumeIdentifierKey;
|
|
|
|
GS_EXPORT NSString *const NSURLPreferredIOBlockSizeKey;
|
|
|
|
GS_EXPORT NSString *const NSURLIsReadableKey;
|
|
|
|
GS_EXPORT NSString *const NSURLIsWritableKey;
|
|
|
|
GS_EXPORT NSString *const NSURLIsExecutableKey;
|
|
|
|
GS_EXPORT NSString *const NSURLFileSecurityKey;
|
|
|
|
GS_EXPORT NSString *const NSURLIsMountTriggerKey;
|
|
|
|
GS_EXPORT NSString *const NSURLFileResourceTypeKey;
|
|
|
|
GS_EXPORT NSString *const NSURLTotalFileSizeKey;
|
|
|
|
GS_EXPORT NSString *const NSURLTotalFileAllocatedSizeKey;
|
|
|
|
GS_EXPORT NSString *const NSURLVolumeSupportsRootDirectoryDatesKey;
|
|
|
|
GS_EXPORT NSString *const NSURLVolumeSupportsVolumeSizesKey;
|
|
|
|
GS_EXPORT NSString *const NSURLVolumeSupportsRenamingKey;
|
|
|
|
GS_EXPORT NSString *const NSURLVolumeSupportsAdvisoryFileLockingKey;
|
|
|
|
GS_EXPORT NSString *const NSURLVolumeSupportsExtendedSecurityKey;
|
|
|
|
GS_EXPORT NSString *const NSURLVolumeIsBrowsableKey;
|
|
|
|
GS_EXPORT NSString *const NSURLVolumeMaximumFileSizeKey;
|
|
|
|
GS_EXPORT NSString *const NSURLVolumeIsEjectableKey;
|
|
|
|
GS_EXPORT NSString *const NSURLVolumeIsRemovableKey;
|
|
|
|
GS_EXPORT NSString *const NSURLVolumeIsInternalKey;
|
|
|
|
GS_EXPORT NSString *const NSURLVolumeIsAutomountedKey;
|
|
|
|
GS_EXPORT NSString *const NSURLVolumeIsLocalKey;
|
|
|
|
GS_EXPORT NSString *const NSURLVolumeIsReadOnlyKey;
|
|
|
|
GS_EXPORT NSString *const NSURLVolumeCreationDateKey;
|
|
|
|
GS_EXPORT NSString *const NSURLVolumeURLForRemountingKey;
|
|
|
|
GS_EXPORT NSString *const NSURLVolumeUUIDStringKey;
|
|
|
|
GS_EXPORT NSString *const NSURLVolumeNameKey;
|
|
|
|
GS_EXPORT NSString *const NSURLVolumeLocalizedNameKey;
|
|
|
|
GS_EXPORT NSString *const NSURLIsUbiquitousItemKey;
|
|
|
|
GS_EXPORT NSString *const NSURLUbiquitousItemHasUnresolvedConflictsKey;
|
|
|
|
GS_EXPORT NSString *const NSURLUbiquitousItemIsDownloadingKey;
|
|
|
|
GS_EXPORT NSString *const NSURLUbiquitousItemIsUploadedKey;
|
|
|
|
GS_EXPORT NSString *const NSURLUbiquitousItemIsUploadingKey;
|
2017-06-21 20:44:40 +00:00
|
|
|
#endif
|
|
|
|
#if OS_API_VERSION(MAC_OS_X_VERSION_10_8, GS_API_LATEST)
|
2021-08-17 10:30:19 +00:00
|
|
|
GS_EXPORT NSString *const NSURLIsExcludedFromBackupKey;
|
|
|
|
GS_EXPORT NSString *const NSURLPathKey;
|
2017-06-21 20:44:40 +00:00
|
|
|
#endif
|
|
|
|
#if OS_API_VERSION(MAC_OS_X_VERSION_10_9, GS_API_LATEST)
|
2021-08-17 10:30:19 +00:00
|
|
|
GS_EXPORT NSString *const NSURLTagNamesKey;
|
|
|
|
GS_EXPORT NSString *const NSURLUbiquitousItemDownloadingStatusKey;
|
|
|
|
GS_EXPORT NSString *const NSURLUbiquitousItemDownloadingErrorKey;
|
|
|
|
GS_EXPORT NSString *const NSURLUbiquitousItemUploadingErrorKey;
|
2017-06-21 20:44:40 +00:00
|
|
|
#endif
|
|
|
|
#if OS_API_VERSION(MAC_OS_X_VERSION_10_10, GS_API_LATEST)
|
2021-08-17 10:30:19 +00:00
|
|
|
GS_EXPORT NSString *const NSURLGenerationIdentifierKey;
|
|
|
|
GS_EXPORT NSString *const NSURLDocumentIdentifierKey;
|
|
|
|
GS_EXPORT NSString *const NSURLAddedToDirectoryDateKey;
|
|
|
|
GS_EXPORT NSString *const NSURLQuarantinePropertiesKey;
|
|
|
|
GS_EXPORT NSString *const NSThumbnail1024x1024SizeKey;
|
|
|
|
GS_EXPORT NSString *const NSURLUbiquitousItemDownloadRequestedKey;
|
|
|
|
GS_EXPORT NSString *const NSURLUbiquitousItemContainerDisplayNameKey;
|
2017-06-21 20:44:40 +00:00
|
|
|
#endif
|
|
|
|
#if OS_API_VERSION(MAC_OS_X_VERSION_10_11, GS_API_LATEST)
|
2021-08-17 10:30:19 +00:00
|
|
|
GS_EXPORT NSString *const NSURLIsApplicationKey;
|
|
|
|
GS_EXPORT NSString *const NSURLApplicationIsScriptableKey;
|
2017-06-21 20:44:40 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
/** Possible values for File Resource Type Key **/
|
|
|
|
#if OS_API_VERSION(MAC_OS_X_VERSION_10_7, GS_API_LATEST)
|
2021-08-17 10:30:19 +00:00
|
|
|
GS_EXPORT NSString *const NSURLFileResourceTypeNamedPipe;
|
|
|
|
GS_EXPORT NSString *const NSURLFileResourceTypeCharacterSpecial;
|
|
|
|
GS_EXPORT NSString *const NSURLFileResourceTypeDirectory;
|
|
|
|
GS_EXPORT NSString *const NSURLFileResourceTypeBlockSpecial;
|
|
|
|
GS_EXPORT NSString *const NSURLFileResourceTypeRegular;
|
|
|
|
GS_EXPORT NSString *const NSURLFileResourceTypeSymbolicLink;
|
|
|
|
GS_EXPORT NSString *const NSURLFileResourceTypeSocket;
|
|
|
|
GS_EXPORT NSString *const NSURLFileResourceTypeUnknown;
|
2017-06-21 20:44:40 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
/** Possible values for Ubiquitous Item Downloading Key **/
|
|
|
|
#if OS_API_VERSION(MAC_OS_X_VERSION_10_9, GS_API_LATEST)
|
2021-08-17 10:30:19 +00:00
|
|
|
GS_EXPORT NSString *const NSURLUbiquitousItemDownloadingStatusNotDownloaded;
|
|
|
|
GS_EXPORT NSString *const NSURLUbiquitousItemDownloadingStatusDownloaded;
|
|
|
|
GS_EXPORT NSString *const NSURLUbiquitousItemDownloadingStatusCurrent;
|
2017-06-21 20:44:40 +00:00
|
|
|
#endif
|
|
|
|
|
2021-08-17 10:30:19 +00:00
|
|
|
#endif /* GS_API_MACOSX */
|
2002-06-06 14:02:59 +00:00
|
|
|
|
2021-08-17 10:30:19 +00:00
|
|
|
#if !NO_GNUSTEP && !defined(GNUSTEP_BASE_INTERNAL)
|
2019-08-01 20:03:16 +00:00
|
|
|
#import <GNUstepBase/NSURL+GNUstepBase.h>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if OS_API_VERSION(MAC_OS_X_VERSION_10_10, GS_API_LATEST)
|
|
|
|
|
2021-01-18 13:20:14 +00:00
|
|
|
GS_EXPORT_CLASS
|
2019-08-01 20:03:16 +00:00
|
|
|
@interface NSURLQueryItem : NSObject <NSCopying, NSCoding>
|
|
|
|
{
|
2021-08-17 10:30:19 +00:00
|
|
|
#if GS_EXPOSE(NSURLQueryItem)
|
2019-08-01 20:03:16 +00:00
|
|
|
#endif
|
2021-08-17 10:30:19 +00:00
|
|
|
#if GS_NONFRAGILE
|
|
|
|
#if defined(GS_NSURLQueryItem_IVARS)
|
2019-08-01 20:03:16 +00:00
|
|
|
@public
|
2021-08-17 10:30:19 +00:00
|
|
|
GS_NSURLQueryItem_IVARS;
|
|
|
|
#endif
|
2019-08-01 20:03:16 +00:00
|
|
|
#else
|
|
|
|
/* Pointer to private additional data used to avoid breaking ABI
|
|
|
|
* when we don't have the non-fragile ABI available.
|
|
|
|
* Use this mechanism rather than changing the instance variable
|
|
|
|
* layout (see Source/GSInternal.h for details).
|
|
|
|
*/
|
2021-08-17 10:30:19 +00:00
|
|
|
@private
|
|
|
|
id _internal GS_UNUSED_IVAR;
|
2019-08-01 20:03:16 +00:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
// Creating query items.
|
2021-08-17 10:30:19 +00:00
|
|
|
+ (instancetype)queryItemWithName:(NSString *)name value:(NSString *)value;
|
|
|
|
- (instancetype)initWithName:(NSString *)name value:(NSString *)value;
|
2019-08-01 20:03:16 +00:00
|
|
|
|
|
|
|
// Reading a name and value from a query
|
2021-08-17 10:30:19 +00:00
|
|
|
- (NSString *)name;
|
|
|
|
- (NSString *)value;
|
2019-08-01 20:03:16 +00:00
|
|
|
@end
|
|
|
|
|
|
|
|
#endif // OS_API_VERSION
|
|
|
|
|
|
|
|
#if OS_API_VERSION(MAC_OS_X_VERSION_10_9, GS_API_LATEST)
|
2021-01-18 13:20:14 +00:00
|
|
|
|
|
|
|
GS_EXPORT_CLASS
|
2019-08-01 20:03:16 +00:00
|
|
|
@interface NSURLComponents : NSObject <NSCopying>
|
|
|
|
{
|
2021-08-17 10:30:19 +00:00
|
|
|
#if GS_EXPOSE(NSURLComponents)
|
2019-08-01 20:03:16 +00:00
|
|
|
#endif
|
2021-08-17 10:30:19 +00:00
|
|
|
#if GS_NONFRAGILE
|
|
|
|
#if defined(GS_NSURLComponents_IVARS)
|
2019-08-01 20:03:16 +00:00
|
|
|
@public
|
2021-08-17 10:30:19 +00:00
|
|
|
GS_NSURLComponents_IVARS;
|
|
|
|
#endif
|
2019-08-01 20:03:16 +00:00
|
|
|
#else
|
|
|
|
/* Pointer to private additional data used to avoid breaking ABI
|
|
|
|
* when we don't have the non-fragile ABI available.
|
|
|
|
* Use this mechanism rather than changing the instance variable
|
|
|
|
* layout (see Source/GSInternal.h for details).
|
|
|
|
*/
|
2021-08-17 10:30:19 +00:00
|
|
|
@private
|
|
|
|
id _internal GS_UNUSED_IVAR;
|
2019-08-01 20:03:16 +00:00
|
|
|
#endif
|
2006-09-13 10:20:49 +00:00
|
|
|
}
|
2021-08-17 10:30:19 +00:00
|
|
|
// Creating URL components...
|
|
|
|
+ (instancetype)componentsWithString:(NSString *)URLString;
|
|
|
|
+ (instancetype)componentsWithURL:(NSURL *)url
|
|
|
|
resolvingAgainstBaseURL:(BOOL)resolve;
|
|
|
|
- (instancetype)init;
|
2019-08-01 20:03:16 +00:00
|
|
|
- (instancetype)initWithString:(NSString *)URLString;
|
|
|
|
|
2021-08-17 10:30:19 +00:00
|
|
|
- (instancetype)initWithURL:(NSURL *)url resolvingAgainstBaseURL:(BOOL)resolve;
|
2019-08-01 20:03:16 +00:00
|
|
|
|
|
|
|
// Getting the URL
|
2021-08-17 10:30:19 +00:00
|
|
|
- (NSString *)string;
|
|
|
|
- (void)setString:(NSString *)urlString;
|
|
|
|
- (NSURL *)URL;
|
|
|
|
- (void)setURL:(NSURL *)url;
|
|
|
|
- (NSURL *)URLRelativeToURL:(NSURL *)baseURL;
|
2019-08-01 20:03:16 +00:00
|
|
|
|
|
|
|
// Accessing Components in Native Format
|
2021-08-17 10:30:19 +00:00
|
|
|
- (NSString *)fragment;
|
|
|
|
- (void)setFragment:(NSString *)fragment;
|
|
|
|
- (NSString *)host;
|
|
|
|
- (void)setHost:(NSString *)host;
|
|
|
|
- (NSString *)password;
|
|
|
|
- (void)setPassword:(NSString *)password;
|
|
|
|
- (NSString *)path;
|
|
|
|
- (void)setPath:(NSString *)path;
|
|
|
|
- (NSNumber *)port;
|
|
|
|
- (void)setPort:(NSNumber *)port;
|
|
|
|
- (NSString *)query;
|
|
|
|
- (void)setQuery:(NSString *)query;
|
2019-08-01 20:03:16 +00:00
|
|
|
#if OS_API_VERSION(MAC_OS_X_VERSION_10_10, GS_API_LATEST)
|
2021-08-17 10:30:19 +00:00
|
|
|
- (NSArray *)queryItems;
|
|
|
|
- (void)setQueryItems:(NSArray *)queryItems;
|
2019-08-01 20:03:16 +00:00
|
|
|
#endif
|
2021-08-17 10:30:19 +00:00
|
|
|
- (NSString *)scheme;
|
|
|
|
- (void)setScheme:(NSString *)scheme;
|
|
|
|
- (NSString *)user;
|
|
|
|
- (void)setUser:(NSString *)user;
|
2019-08-01 20:03:16 +00:00
|
|
|
|
|
|
|
// Accessing Components in PercentEncoded Format
|
2021-08-17 10:30:19 +00:00
|
|
|
- (NSString *)percentEncodedFragment;
|
|
|
|
- (void)setPercentEncodedFragment:(NSString *)fragment;
|
|
|
|
- (NSString *)percentEncodedHost;
|
|
|
|
- (void)setPercentEncodedHost:(NSString *)host;
|
|
|
|
- (NSString *)percentEncodedPassword;
|
|
|
|
- (void)setPercentEncodedPassword:(NSString *)password;
|
|
|
|
- (NSString *)percentEncodedPath;
|
|
|
|
- (void)setPercentEncodedPath:(NSString *)path;
|
|
|
|
- (NSString *)percentEncodedQuery;
|
|
|
|
- (void)setPercentEncodedQuery:(NSString *)query;
|
2019-08-01 20:03:16 +00:00
|
|
|
#if OS_API_VERSION(MAC_OS_X_VERSION_10_10, GS_API_LATEST)
|
2021-08-17 10:30:19 +00:00
|
|
|
- (NSArray *)percentEncodedQueryItems;
|
|
|
|
- (void)setPercentEncodedQueryItems:(NSArray *)queryItems;
|
2019-08-01 20:03:16 +00:00
|
|
|
#endif
|
2021-08-17 10:30:19 +00:00
|
|
|
- (NSString *)percentEncodedUser;
|
|
|
|
- (void)setPercentEncodedUser:(NSString *)user;
|
2019-08-01 20:03:16 +00:00
|
|
|
|
|
|
|
// Locating components of the URL string representation
|
2021-08-17 10:30:19 +00:00
|
|
|
- (NSRange)rangeOfFragment;
|
|
|
|
- (NSRange)rangeOfHost;
|
|
|
|
- (NSRange)rangeOfPassword;
|
|
|
|
- (NSRange)rangeOfPath;
|
|
|
|
- (NSRange)rangeOfPort;
|
|
|
|
- (NSRange)rangeOfQuery;
|
|
|
|
- (NSRange)rangeOfScheme;
|
|
|
|
- (NSRange)rangeOfUser;
|
|
|
|
|
2019-08-01 20:03:16 +00:00
|
|
|
@end
|
2006-09-13 10:20:49 +00:00
|
|
|
|
2019-08-01 20:03:16 +00:00
|
|
|
#if defined(__cplusplus)
|
|
|
|
}
|
2010-02-18 11:40:58 +00:00
|
|
|
#endif
|
|
|
|
|
2021-08-17 10:30:19 +00:00
|
|
|
#endif /* GS_API_MACOSX */
|
2019-08-01 20:03:16 +00:00
|
|
|
|
2021-08-17 10:30:19 +00:00
|
|
|
#endif /* __NSURL_h_GNUSTEP_BASE_INCLUDE */
|
2019-08-01 20:03:16 +00:00
|
|
|
|