Struct cxx_qt_lib::QUrl
source · #[repr(C)]pub struct QUrl { /* private fields */ }
Expand description
The QUrl class provides a convenient interface for working with URLs.
Implementations§
source§impl QUrl
impl QUrl
sourcepub fn error_string(&self) -> QString
pub fn error_string(&self) -> QString
Returns an error message if the last operation that modified this QUrl object ran into a parsing error. If no error was detected, this function returns an empty string and isValid() returns true.
source§impl QUrl
impl QUrl
sourcepub fn has_fragment(&self) -> bool
pub fn has_fragment(&self) -> bool
Returns true if this URL contains a fragment (i.e., if # was seen on it).
source§impl QUrl
impl QUrl
sourcepub fn is_local_file(&self) -> bool
pub fn is_local_file(&self) -> bool
Returns true if this URL is pointing to a local file path. A URL is a local file path if the scheme is “file”.
source§impl QUrl
impl QUrl
sourcepub fn is_parent_of(&self, child_url: &QUrl) -> bool
pub fn is_parent_of(&self, child_url: &QUrl) -> bool
Returns true if this URL is a parent of child_url. childUrl is a child of this URL if the two URLs share the same scheme and authority, and this URL’s path is a parent of the path of child_url.
source§impl QUrl
impl QUrl
sourcepub fn is_relative(&self) -> bool
pub fn is_relative(&self) -> bool
Returns true if the URL is relative; otherwise returns false. A URL is relative reference if its scheme is undefined; this function is therefore equivalent to calling scheme().is_empty().
source§impl QUrl
impl QUrl
sourcepub fn scheme_or_default(&self) -> QString
pub fn scheme_or_default(&self) -> QString
Returns the scheme of the URL. If an empty string is returned, this means the scheme is undefined and the URL is then relative.
The scheme can only contain US-ASCII letters or digits, which means it cannot contain any character that would otherwise require encoding Additionally, schemes are always returned in lowercase form.
source§impl QUrl
impl QUrl
sourcepub fn to_local_file_or_default(&self) -> QString
pub fn to_local_file_or_default(&self) -> QString
Returns the path of this URL formatted as a local file path. The path returned will use forward slashes, even if it was originally created from one with backslashes.
source§impl QUrl
impl QUrl
Returns the authority of the URL if it is defined; otherwise an empty string is returned.
sourcepub fn file_name(&self) -> QString
pub fn file_name(&self) -> QString
Returns the name of the file, excluding the directory path.
Note that, if this QUrl object is given a path ending in a slash, the name of the file is considered empty.
If the path doesn’t contain any slash, it is fully returned as the fileName.
sourcepub fn fragment_or_default(&self) -> QString
pub fn fragment_or_default(&self) -> QString
Returns the fragment of the URL if it is defined; otherwise an empty string is returned.
sourcepub fn from_encoded(input: &QByteArray) -> Self
pub fn from_encoded(input: &QByteArray) -> Self
Parses input and returns the corresponding QUrl. input is assumed to be in encoded form, containing only ASCII characters.
sourcepub fn from_local_file(local_file: &QString) -> Self
pub fn from_local_file(local_file: &QString) -> Self
Returns a QUrl representation of localFile, interpreted as a local file. This function accepts paths separated by slashes as well as the native separator for this platform.
sourcepub fn from_percent_encoding(input: &QByteArray) -> QString
pub fn from_percent_encoding(input: &QByteArray) -> QString
Returns a decoded copy of input. input is first decoded from percent encoding, then converted from UTF-8 to unicode.
sourcepub fn from_user_input(
user_input: &QString,
working_directory: &QString
) -> Self
pub fn from_user_input( user_input: &QString, working_directory: &QString ) -> Self
Returns a valid URL from a user supplied userInput string if one can be deduced. In the case that is not possible, an invalid QUrl() is returned.
sourcepub fn host_or_default(&self) -> QString
pub fn host_or_default(&self) -> QString
Returns the host of the URL if it is defined; otherwise an empty string is returned.
sourcepub fn idn_whitelist() -> QStringList
pub fn idn_whitelist() -> QStringList
Returns the current whitelist of top-level domains that are allowed to have non-ASCII characters in their compositions.
sourcepub fn password_or_default(&self) -> QString
pub fn password_or_default(&self) -> QString
Returns the password of the URL if it is defined; otherwise an empty string is returned.
sourcepub fn query(&self) -> Option<QString>
pub fn query(&self) -> Option<QString>
Returns the query string of the URL if there’s a query string
sourcepub fn query_or_default(&self) -> QString
pub fn query_or_default(&self) -> QString
Returns the query string of the URL if it is defined; otherwise an empty string is returned.
sourcepub fn scheme(&self) -> Option<QString>
pub fn scheme(&self) -> Option<QString>
Returns the scheme of the URL. If the Option is None, this means the scheme is undefined and the URL is then relative.
The scheme can only contain US-ASCII letters or digits, which means it cannot contain any character that would otherwise require encoding Additionally, schemes are always returned in lowercase form.
Sets the authority of the URL to authority.
sourcepub fn set_fragment(&mut self, fragment: &QString)
pub fn set_fragment(&mut self, fragment: &QString)
Sets the fragment of the URL to fragment. The fragment is the last part of the URL, represented by a ‘#’ followed by a string of characters.
sourcepub fn set_host(&mut self, host: &QString)
pub fn set_host(&mut self, host: &QString)
Sets the host of the URL to host. The host is part of the authority.
sourcepub fn set_idn_whitelist(list: &QStringList)
pub fn set_idn_whitelist(list: &QStringList)
Sets the whitelist of Top-Level Domains (TLDs) that are allowed to have non-ASCII characters in domains to the value of list.
sourcepub fn set_password(&mut self, password: &QString)
pub fn set_password(&mut self, password: &QString)
Sets the URL’s password to password.
sourcepub fn set_path(&mut self, path: &QString)
pub fn set_path(&mut self, path: &QString)
Sets the path of the URL to path. The path is the part of the URL that comes after the authority but before the query string.
sourcepub fn set_scheme(&mut self, scheme: &QString)
pub fn set_scheme(&mut self, scheme: &QString)
Sets the scheme of the URL to scheme. As a scheme can only contain ASCII characters, no conversion or decoding is done on the input. It must also start with an ASCII letter.
sourcepub fn set_url(&mut self, url: &QString)
pub fn set_url(&mut self, url: &QString)
Parses url and sets this object to that value. QUrl will automatically percent encode all characters that are not allowed in a URL and decode the percent-encoded sequences that represent an unreserved character (letters, digits, hyphens, underscores, dots and tildes). All other characters are left in their original forms.
sourcepub fn set_user_info(&mut self, user_info: &QString)
pub fn set_user_info(&mut self, user_info: &QString)
Sets the user info of the URL to userInfo.
sourcepub fn set_user_name(&mut self, user_name: &QString)
pub fn set_user_name(&mut self, user_name: &QString)
Sets the URL’s user name to userName.
sourcepub fn to_display_string(&self) -> QString
pub fn to_display_string(&self) -> QString
Returns a human-displayable string representation of the URL. The option RemovePassword is always enabled, since passwords should never be shown back to users.
sourcepub fn to_encoded(&self) -> QByteArray
pub fn to_encoded(&self) -> QByteArray
Returns the encoded representation of the URL if it’s valid; otherwise an empty QByteArray is returned.
sourcepub fn to_local_file(&self) -> Option<QString>
pub fn to_local_file(&self) -> Option<QString>
Returns the path of this URL formatted as a local file path. The path returned will use forward slashes, even if it was originally created from one with backslashes.
sourcepub fn to_percent_encoding(
input: &QString,
exclude: &QByteArray,
include: &QByteArray
) -> QByteArray
pub fn to_percent_encoding( input: &QString, exclude: &QByteArray, include: &QByteArray ) -> QByteArray
Returns an encoded copy of input. input is first converted to UTF-8, and all ASCII-characters that are not in the unreserved group are percent encoded. To prevent characters from being percent encoded pass them to exclude. To force characters to be percent encoded pass them to include.
sourcepub fn to_qstring(&self) -> QString
pub fn to_qstring(&self) -> QString
Returns a QString representation of the URL.
sourcepub fn user_info_or_default(&self) -> QString
pub fn user_info_or_default(&self) -> QString
Returns the user info of the URL, or an empty string if the user info is undefined.
sourcepub fn user_name_or_default(&self) -> QString
pub fn user_name_or_default(&self) -> QString
Returns the user name of the URL if it is defined; otherwise an empty string is returned.