Struct xpcom::interfaces::nsIURL
[−]
[src]
#[repr(C)]pub struct nsIURL { /* fields omitted */ }
interface nsIURL : nsIURI
/**
* The nsIURL interface provides convenience methods that further
* break down the path portion of nsIURI:
*
* http://host/directory/fileBaseName.fileExtension?query
* http://host/directory/fileBaseName.fileExtension#ref
* \ \ /
* \ -----------------------
* \ | /
* \ fileName /
* ----------------------------
* |
* filePath
*/
Methods
impl nsIURL
[src]
impl nsIURL
[src]
pub unsafe fn GetDirectory(&self, aDirectory: &mut nsACString) -> nsresult
[src]
/*************************************************************************
* The URL path is broken down into the following principal components:
*
* attribute AUTF8String filePath;
* attribute AUTF8String query;
*
* These are inherited from nsIURI.
*/
/*************************************************************************
* The URL filepath is broken down into the following sub-components:
*/
/**
* Returns the directory portion of a URL. If the URL denotes a path to a
* directory and not a file, e.g. http://host/foo/bar/, then the Directory
* attribute accesses the complete /foo/bar/ portion, and the FileName is
* the empty string. If the trailing slash is omitted, then the Directory
* is /foo/ and the file is bar (i.e. this is a syntactic, not a semantic
* breakdown of the Path). And hence don't rely on this for something to
* be a definitely be a file. But you can get just the leading directory
* portion for sure.
*
* Some characters may be escaped.
*/
attribute AUTF8String directory;
pub unsafe fn SetDirectory(&self, aDirectory: &nsACString) -> nsresult
[src]
/*************************************************************************
* The URL path is broken down into the following principal components:
*
* attribute AUTF8String filePath;
* attribute AUTF8String query;
*
* These are inherited from nsIURI.
*/
/*************************************************************************
* The URL filepath is broken down into the following sub-components:
*/
/**
* Returns the directory portion of a URL. If the URL denotes a path to a
* directory and not a file, e.g. http://host/foo/bar/, then the Directory
* attribute accesses the complete /foo/bar/ portion, and the FileName is
* the empty string. If the trailing slash is omitted, then the Directory
* is /foo/ and the file is bar (i.e. this is a syntactic, not a semantic
* breakdown of the Path). And hence don't rely on this for something to
* be a definitely be a file. But you can get just the leading directory
* portion for sure.
*
* Some characters may be escaped.
*/
attribute AUTF8String directory;
pub unsafe fn GetFileName(&self, aFileName: &mut nsACString) -> nsresult
[src]
/**
* Returns the file name portion of a URL. If the URL denotes a path to a
* directory and not a file, e.g. http://host/foo/bar/, then the Directory
* attribute accesses the complete /foo/bar/ portion, and the FileName is
* the empty string. Note that this is purely based on searching for the
* last trailing slash. And hence don't rely on this to be a definite file.
*
* Some characters may be escaped.
*/
attribute AUTF8String fileName;
pub unsafe fn SetFileName(&self, aFileName: &nsACString) -> nsresult
[src]
/**
* Returns the file name portion of a URL. If the URL denotes a path to a
* directory and not a file, e.g. http://host/foo/bar/, then the Directory
* attribute accesses the complete /foo/bar/ portion, and the FileName is
* the empty string. Note that this is purely based on searching for the
* last trailing slash. And hence don't rely on this to be a definite file.
*
* Some characters may be escaped.
*/
attribute AUTF8String fileName;
pub unsafe fn GetFileBaseName(&self, aFileBaseName: &mut nsACString) -> nsresult
[src]
/*************************************************************************
* The URL filename is broken down even further:
*/
/**
* Returns the file basename portion of a filename in a url.
*
* Some characters may be escaped.
*/
attribute AUTF8String fileBaseName;
pub unsafe fn SetFileBaseName(&self, aFileBaseName: &nsACString) -> nsresult
[src]
/*************************************************************************
* The URL filename is broken down even further:
*/
/**
* Returns the file basename portion of a filename in a url.
*
* Some characters may be escaped.
*/
attribute AUTF8String fileBaseName;
pub unsafe fn GetFileExtension(
&self,
aFileExtension: &mut nsACString
) -> nsresult
[src]
&self,
aFileExtension: &mut nsACString
) -> nsresult
/**
* Returns the file extension portion of a filename in a url. If a file
* extension does not exist, the empty string is returned.
*
* Some characters may be escaped.
*/
attribute AUTF8String fileExtension;
pub unsafe fn SetFileExtension(&self, aFileExtension: &nsACString) -> nsresult
[src]
/**
* Returns the file extension portion of a filename in a url. If a file
* extension does not exist, the empty string is returned.
*
* Some characters may be escaped.
*/
attribute AUTF8String fileExtension;
pub unsafe fn GetCommonBaseSpec(
&self,
aURIToCompare: *const nsIURI,
_retval: &mut nsACString
) -> nsresult
[src]
&self,
aURIToCompare: *const nsIURI,
_retval: &mut nsACString
) -> nsresult
/**
* This method takes a uri and compares the two. The common uri portion
* is returned as a string. The minimum common uri portion is the
* protocol, and any of these if present: login, password, host and port
* If no commonality is found, "" is returned. If they are identical, the
* whole path with file/ref/etc. is returned. For file uris, it is
* expected that the common spec would be at least "file:///" since '/' is
* a shared common root.
*
* Examples:
* this.spec aURIToCompare.spec result
* 1) http://mozilla.org/ http://www.mozilla.org/ ""
* 2) http://foo.com/bar/ ftp://foo.com/bar/ ""
* 3) http://foo.com:8080/ http://foo.com/bar/ ""
* 4) ftp://user@foo.com/ ftp://user:pw@foo.com/ ""
* 5) ftp://foo.com/bar/ ftp://foo.com/bar ftp://foo.com/
* 6) ftp://foo.com/bar/ ftp://foo.com/bar/b.html ftp://foo.com/bar/
* 7) http://foo.com/a.htm#i http://foo.com/b.htm http://foo.com/
* 8) ftp://foo.com/c.htm#i ftp://foo.com/c.htm ftp://foo.com/c.htm
* 9) file:///a/b/c.html file:///d/e/c.html file:///
*/
AUTF8String getCommonBaseSpec (in nsIURI aURIToCompare);
pub unsafe fn GetRelativeSpec(
&self,
aURIToCompare: *const nsIURI,
_retval: &mut nsACString
) -> nsresult
[src]
&self,
aURIToCompare: *const nsIURI,
_retval: &mut nsACString
) -> nsresult
/**
* This method tries to create a string which specifies the location of the
* argument relative to |this|. If the argument and |this| are equal, the
* method returns "". If any of the URIs' scheme, host, userpass, or port
* don't match, the method returns the full spec of the argument.
*
* Examples:
* this.spec aURIToCompare.spec result
* 1) http://mozilla.org/ http://www.mozilla.org/ http://www.mozilla.org/
* 2) http://mozilla.org/ http://www.mozilla.org http://www.mozilla.org/
* 3) http://foo.com/bar/ http://foo.com:80/bar/ ""
* 4) http://foo.com/ http://foo.com/a.htm#b a.html#b
* 5) http://foo.com/a/b/ http://foo.com/c ../../c
*/
AUTF8String getRelativeSpec (in nsIURI aURIToCompare);
Methods from Deref<Target = nsIURI>
pub unsafe fn GetSpec(&self, aSpec: &mut nsACString) -> nsresult
[src]
/************************************************************************
* The URI is broken down into the following principal components:
*/
/**
* Returns a string representation of the URI. Setting the spec causes
* the new spec to be parsed per the rules for the scheme the URI
* currently has. In particular, setting the spec to a URI string with a
* different scheme will generally produce incorrect results; no one
* outside of a protocol handler implementation should be doing that. If
* the URI stores information from the nsIIOService.newURI call used to
* create it other than just the parsed string, then behavior of this
* information on setting the spec attribute is undefined.
*
* Some characters may be escaped.
*/
attribute AUTF8String spec;
pub unsafe fn SetSpec(&self, aSpec: &nsACString) -> nsresult
[src]
/************************************************************************
* The URI is broken down into the following principal components:
*/
/**
* Returns a string representation of the URI. Setting the spec causes
* the new spec to be parsed per the rules for the scheme the URI
* currently has. In particular, setting the spec to a URI string with a
* different scheme will generally produce incorrect results; no one
* outside of a protocol handler implementation should be doing that. If
* the URI stores information from the nsIIOService.newURI call used to
* create it other than just the parsed string, then behavior of this
* information on setting the spec attribute is undefined.
*
* Some characters may be escaped.
*/
attribute AUTF8String spec;
pub unsafe fn GetPrePath(&self, aPrePath: &mut nsACString) -> nsresult
[src]
/**
* The prePath (eg. scheme://user:password@host:port) returns the string
* before the path. This is useful for authentication or managing sessions.
*
* Some characters may be escaped.
*/
readonly attribute AUTF8String prePath;
pub unsafe fn GetScheme(&self, aScheme: &mut nsACString) -> nsresult
[src]
/**
* The Scheme is the protocol to which this URI refers. The scheme is
* restricted to the US-ASCII charset per RFC3986. Setting this is
* highly discouraged outside of a protocol handler implementation, since
* that will generally lead to incorrect results.
*/
attribute ACString scheme;
pub unsafe fn SetScheme(&self, aScheme: &nsACString) -> nsresult
[src]
/**
* The Scheme is the protocol to which this URI refers. The scheme is
* restricted to the US-ASCII charset per RFC3986. Setting this is
* highly discouraged outside of a protocol handler implementation, since
* that will generally lead to incorrect results.
*/
attribute ACString scheme;
pub unsafe fn GetUserPass(&self, aUserPass: &mut nsACString) -> nsresult
[src]
/**
* The username:password (or username only if value doesn't contain a ':')
*
* Some characters may be escaped.
*/
attribute AUTF8String userPass;
pub unsafe fn SetUserPass(&self, aUserPass: &nsACString) -> nsresult
[src]
/**
* The username:password (or username only if value doesn't contain a ':')
*
* Some characters may be escaped.
*/
attribute AUTF8String userPass;
pub unsafe fn GetUsername(&self, aUsername: &mut nsACString) -> nsresult
[src]
/**
* The optional username and password, assuming the preHost consists of
* username:password.
*
* Some characters may be escaped.
*/
attribute AUTF8String username;
pub unsafe fn SetUsername(&self, aUsername: &nsACString) -> nsresult
[src]
/**
* The optional username and password, assuming the preHost consists of
* username:password.
*
* Some characters may be escaped.
*/
attribute AUTF8String username;
pub unsafe fn GetPassword(&self, aPassword: &mut nsACString) -> nsresult
[src]
attribute AUTF8String password;
pub unsafe fn SetPassword(&self, aPassword: &nsACString) -> nsresult
[src]
attribute AUTF8String password;
pub unsafe fn GetHostPort(&self, aHostPort: &mut nsACString) -> nsresult
[src]
/**
* The host:port (or simply the host, if port == -1).
*
* If this attribute is set to a value that only has a host part, the port
* will not be reset. To reset the port as well use setHostAndPort.
*/
attribute AUTF8String hostPort;
pub unsafe fn SetHostPort(&self, aHostPort: &nsACString) -> nsresult
[src]
/**
* The host:port (or simply the host, if port == -1).
*
* If this attribute is set to a value that only has a host part, the port
* will not be reset. To reset the port as well use setHostAndPort.
*/
attribute AUTF8String hostPort;
pub unsafe fn SetHostAndPort(&self, hostport: &nsACString) -> nsresult
[src]
/**
* This function will always set a host and a port. If the port part is
* empty, the value of the port will be set to the default value.
*/
void setHostAndPort (in AUTF8String hostport);
pub unsafe fn GetHost(&self, aHost: &mut nsACString) -> nsresult
[src]
/**
* The host is the internet domain name to which this URI refers. It could
* be an IPv4 (or IPv6) address literal. Otherwise it is an ASCII or punycode
* encoded string.
*/
attribute AUTF8String host;
pub unsafe fn SetHost(&self, aHost: &nsACString) -> nsresult
[src]
/**
* The host is the internet domain name to which this URI refers. It could
* be an IPv4 (or IPv6) address literal. Otherwise it is an ASCII or punycode
* encoded string.
*/
attribute AUTF8String host;
pub unsafe fn GetPort(&self, aPort: *mut int32_t) -> nsresult
[src]
/**
* A port value of -1 corresponds to the protocol's default port (eg. -1
* implies port 80 for http URIs).
*/
attribute long port;
pub unsafe fn SetPort(&self, aPort: int32_t) -> nsresult
[src]
/**
* A port value of -1 corresponds to the protocol's default port (eg. -1
* implies port 80 for http URIs).
*/
attribute long port;
pub unsafe fn GetPathQueryRef(&self, aPathQueryRef: &mut nsACString) -> nsresult
[src]
/**
* The path, typically including at least a leading '/' (but may also be
* empty, depending on the protocol).
*
* Some characters may be escaped.
*
* This attribute contains query and ref parts for historical reasons.
* Use the 'filePath' attribute if you do not want those parts included.
*/
attribute AUTF8String pathQueryRef;
pub unsafe fn SetPathQueryRef(&self, aPathQueryRef: &nsACString) -> nsresult
[src]
/**
* The path, typically including at least a leading '/' (but may also be
* empty, depending on the protocol).
*
* Some characters may be escaped.
*
* This attribute contains query and ref parts for historical reasons.
* Use the 'filePath' attribute if you do not want those parts included.
*/
attribute AUTF8String pathQueryRef;
pub unsafe fn Equals(
&self,
other: *const nsIURI,
_retval: *mut bool
) -> nsresult
[src]
&self,
other: *const nsIURI,
_retval: *mut bool
) -> nsresult
/************************************************************************
* An URI supports the following methods:
*/
/**
* URI equivalence test (not a strict string comparison).
*
* eg. http://foo.com:80/ == http://foo.com/
*/
boolean equals (in nsIURI other);
pub unsafe fn SchemeIs(
&self,
scheme: *const c_char,
_retval: *mut bool
) -> nsresult
[src]
&self,
scheme: *const c_char,
_retval: *mut bool
) -> nsresult
/**
* An optimization to do scheme checks without requiring the users of nsIURI
* to GetScheme, thereby saving extra allocating and freeing. Returns true if
* the schemes match (case ignored).
*/
boolean schemeIs (in string scheme);
pub unsafe fn Clone(&self, _retval: *mut *const nsIURI) -> nsresult
[src]
/**
* Clones the current URI.
*/
nsIURI clone ();
pub unsafe fn Resolve(
&self,
relativePath: &nsACString,
_retval: &mut nsACString
) -> nsresult
[src]
&self,
relativePath: &nsACString,
_retval: &mut nsACString
) -> nsresult
/**
* This method resolves a relative string into an absolute URI string,
* using this URI as the base.
*
* NOTE: some implementations may have no concept of a relative URI.
*/
AUTF8String resolve (in AUTF8String relativePath);
pub unsafe fn GetAsciiSpec(&self, aAsciiSpec: &mut nsACString) -> nsresult
[src]
/************************************************************************
* Additional attributes:
*/
/**
* The URI spec with an ASCII compatible encoding. Host portion follows
* the IDNA draft spec. Other parts are URL-escaped per the rules of
* RFC2396. The result is strictly ASCII.
*/
readonly attribute ACString asciiSpec;
pub unsafe fn GetAsciiHostPort(
&self,
aAsciiHostPort: &mut nsACString
) -> nsresult
[src]
&self,
aAsciiHostPort: &mut nsACString
) -> nsresult
/**
* The host:port (or simply the host, if port == -1), with an ASCII compatible
* encoding. Host portion follows the IDNA draft spec. The result is strictly
* ASCII.
*/
readonly attribute ACString asciiHostPort;
pub unsafe fn GetAsciiHost(&self, aAsciiHost: &mut nsACString) -> nsresult
[src]
/**
* The URI host with an ASCII compatible encoding. Follows the IDNA
* draft spec for converting internationalized domain names (UTF-8) to
* ASCII for compatibility with existing internet infrasture.
*/
readonly attribute ACString asciiHost;
pub unsafe fn GetRef(&self, aRef: &mut nsACString) -> nsresult
[src]
/************************************************************************
* Additional attribute & methods added for .ref support:
*/
/**
* Returns the reference portion (the part after the "#") of the URI.
* If there isn't one, an empty string is returned.
*
* Some characters may be escaped.
*/
attribute AUTF8String ref;
pub unsafe fn SetRef(&self, aRef: &nsACString) -> nsresult
[src]
/************************************************************************
* Additional attribute & methods added for .ref support:
*/
/**
* Returns the reference portion (the part after the "#") of the URI.
* If there isn't one, an empty string is returned.
*
* Some characters may be escaped.
*/
attribute AUTF8String ref;
pub unsafe fn EqualsExceptRef(
&self,
other: *const nsIURI,
_retval: *mut bool
) -> nsresult
[src]
&self,
other: *const nsIURI,
_retval: *mut bool
) -> nsresult
/**
* URI equivalence test (not a strict string comparison), ignoring
* the value of the .ref member.
*
* eg. http://foo.com/# == http://foo.com/
* http://foo.com/#aaa == http://foo.com/#bbb
*/
boolean equalsExceptRef (in nsIURI other);
pub unsafe fn CloneIgnoringRef(&self, _retval: *mut *const nsIURI) -> nsresult
[src]
/**
* Clones the current URI, clearing the 'ref' attribute in the clone.
*/
nsIURI cloneIgnoringRef ();
pub unsafe fn CloneWithNewRef(
&self,
newRef: &nsACString,
_retval: *mut *const nsIURI
) -> nsresult
[src]
&self,
newRef: &nsACString,
_retval: *mut *const nsIURI
) -> nsresult
/**
* Clones the current URI, replacing the 'ref' attribute in the clone with
* the ref supplied.
*/
nsIURI cloneWithNewRef (in AUTF8String newRef);
pub unsafe fn GetSpecIgnoringRef(
&self,
aSpecIgnoringRef: &mut nsACString
) -> nsresult
[src]
&self,
aSpecIgnoringRef: &mut nsACString
) -> nsresult
/**
* returns a string for the current URI with the ref element cleared.
*/
readonly attribute AUTF8String specIgnoringRef;
pub unsafe fn GetHasRef(&self, aHasRef: *mut bool) -> nsresult
[src]
/**
* Returns if there is a reference portion (the part after the "#") of the URI.
*/
readonly attribute boolean hasRef;
pub unsafe fn GetFilePath(&self, aFilePath: &mut nsACString) -> nsresult
[src]
/************************************************************************
* Additional attributes added for .query support:
*/
/**
* Returns a path including the directory and file portions of a
* URL. For example, the filePath of "http://host/foo/bar.html#baz"
* is "/foo/bar.html".
*
* Some characters may be escaped.
*/
attribute AUTF8String filePath;
pub unsafe fn SetFilePath(&self, aFilePath: &nsACString) -> nsresult
[src]
/************************************************************************
* Additional attributes added for .query support:
*/
/**
* Returns a path including the directory and file portions of a
* URL. For example, the filePath of "http://host/foo/bar.html#baz"
* is "/foo/bar.html".
*
* Some characters may be escaped.
*/
attribute AUTF8String filePath;
pub unsafe fn GetQuery(&self, aQuery: &mut nsACString) -> nsresult
[src]
/**
* Returns the query portion (the part after the "?") of the URL.
* If there isn't one, an empty string is returned.
*
* Some characters may be escaped.
*/
attribute AUTF8String query;
pub unsafe fn SetQuery(&self, aQuery: &nsACString) -> nsresult
[src]
/**
* Returns the query portion (the part after the "?") of the URL.
* If there isn't one, an empty string is returned.
*
* Some characters may be escaped.
*/
attribute AUTF8String query;
pub unsafe fn GetDisplayHost(&self, aDisplayHost: &mut nsACString) -> nsresult
[src]
/**
* If the URI has a punycode encoded hostname, this will hold the UTF8
* representation of that hostname (if that representation doesn't contain
* blacklisted characters, and the network.IDN_show_punycode pref is false)
* Otherwise, if the hostname is ASCII, it will return the same as .asciiHost
*/
readonly attribute AUTF8String displayHost;
pub unsafe fn GetDisplayHostPort(
&self,
aDisplayHostPort: &mut nsACString
) -> nsresult
[src]
&self,
aDisplayHostPort: &mut nsACString
) -> nsresult
/**
* The displayHost:port (or simply the displayHost, if port == -1).
*/
readonly attribute AUTF8String displayHostPort;
pub unsafe fn GetDisplaySpec(&self, aDisplaySpec: &mut nsACString) -> nsresult
[src]
/**
* Returns the same as calling .spec, only with a UTF8 encoded hostname
* (if that hostname doesn't contain blacklisted characters, and
* the network.IDN_show_punycode pref is false)
*/
readonly attribute AUTF8String displaySpec;
pub unsafe fn GetDisplayPrePath(
&self,
aDisplayPrePath: &mut nsACString
) -> nsresult
[src]
&self,
aDisplayPrePath: &mut nsACString
) -> nsresult
/**
* Returns the same as calling .prePath, only with a UTF8 encoded hostname
* (if that hostname doesn't contain blacklisted characters, and
* the network.IDN_show_punycode pref is false)
*/
readonly attribute AUTF8String displayPrePath;
pub unsafe fn Mutate(&self, _retval: *mut *const nsIURIMutator) -> nsresult
[src]
/**
* Returns an nsIURIMutator that can be used to make changes to the URI.
* After performing the setter operations on the mutator, one may call
* mutator.finalize() to get a new immutable URI with the desired
* properties.
*/
nsIURIMutator mutate ();
Trait Implementations
impl XpCom for nsIURL
[src]
const IID: nsIID
IID: nsIID = nsID(2259537289, 2928, 18338, [176, 254, 91, 178, 197, 243, 126, 49])
fn query_interface<T: XpCom>(&self) -> Option<RefPtr<T>>
[src]
Perform a QueryInterface call on this object, attempting to dynamically cast it to the requested interface type. Returns Some(RefPtr) if the cast succeeded, and None otherwise. Read more
impl RefCounted for nsIURL
[src]
unsafe fn addref(&self)
[src]
Increment the reference count.
unsafe fn release(&self)
[src]
Decrement the reference count, potentially freeing backing memory.