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

source

pub fn clear(&mut self)

Resets the content of the QUrl. After calling this function, the QUrl is equal to one that has been constructed with the default empty constructor.

source§

impl QUrl

source

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

source

pub fn has_fragment(&self) -> bool

Returns true if this URL contains a fragment (i.e., if # was seen on it).

source§

impl QUrl

source

pub fn has_query(&self) -> bool

Returns true if this URL contains a Query (i.e., if ? was seen on it).

source§

impl QUrl

source

pub fn is_empty(&self) -> bool

Returns true if the URL has no data; otherwise returns false.

source§

impl QUrl

source

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

source

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

source

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

source

pub fn is_valid(&self) -> bool

Returns true if the URL is non-empty and valid; otherwise returns false.

source§

impl QUrl

source

pub fn port_or(&self, port: i32) -> i32

Returns the port of the URL, or defaultPort if the port is unspecified.

source§

impl QUrl

source

pub fn resolved(&self, relative: &QUrl) -> QUrl

Returns the result of the merge of this URL with relative. This URL is used as a base to convert relative to an absolute URL.

source§

impl QUrl

source

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

source

pub fn set_port(&mut self, port: i32)

Sets the port of the URL to port.

port must be between 0 and 65535 inclusive. Setting the port to -1 indicates that the port is unspecified.

source§

impl QUrl

source

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

source

pub fn authority_or_default(&self) -> QString

Returns the authority of the URL if it is defined; otherwise an empty string is returned.

source

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.

source

pub fn fragment(&self) -> Option<QString>

Returns the fragment of the URL.

source

pub fn fragment_or_default(&self) -> QString

Returns the fragment of the URL if it is defined; otherwise an empty string is returned.

source

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.

source

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.

source

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.

source

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.

source

pub fn host_or_default(&self) -> QString

Returns the host of the URL if it is defined; otherwise an empty string is returned.

source

pub fn idn_whitelist() -> QStringList

Returns the current whitelist of top-level domains that are allowed to have non-ASCII characters in their compositions.

source

pub fn password_or_default(&self) -> QString

Returns the password of the URL if it is defined; otherwise an empty string is returned.

source

pub fn path(&self) -> QString

Returns the path of the URL.

source

pub fn query(&self) -> Option<QString>

Returns the query string of the URL if there’s a query string

source

pub fn query_or_default(&self) -> QString

Returns the query string of the URL if it is defined; otherwise an empty string is returned.

source

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.

source

pub fn set_authority(&mut self, authority: &QString)

Sets the authority of the URL to authority.

source

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.

source

pub fn set_host(&mut self, host: &QString)

Sets the host of the URL to host. The host is part of the authority.

source

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.

source

pub fn set_password(&mut self, password: &QString)

Sets the URL’s password to password.

source

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.

source

pub fn set_query(&mut self, query: &QString)

Sets the query string of the URL to query.

source

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.

source

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.

source

pub fn set_user_info(&mut self, user_info: &QString)

Sets the user info of the URL to userInfo.

source

pub fn set_user_name(&mut self, user_name: &QString)

Sets the URL’s user name to userName.

source

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.

source

pub fn to_encoded(&self) -> QByteArray

Returns the encoded representation of the URL if it’s valid; otherwise an empty QByteArray is returned.

source

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.

source

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.

source

pub fn to_qstring(&self) -> QString

Returns a QString representation of the URL.

source

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.

source

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.

Trait Implementations§

source§

impl Clone for QUrl

source§

fn clone(&self) -> Self

Constructs a copy of other.

1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for QUrl

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Default for QUrl

source§

fn default() -> Self

Constructs an empty QUrl object.

source§

impl Display for QUrl

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Convert the QUrl to a Rust string

Note that this converts from UTF-16 to UTF-8

source§

impl Drop for QUrl

source§

fn drop(&mut self)

Destructor; called immediately before the object is deleted.

source§

impl ExternType for QUrl

§

type Id = (Q, U, r, l)

A type-level representation of the type’s C++ namespace and type name. Read more
§

type Kind = Trivial

source§

impl From<&QString> for QUrl

source§

fn from(str: &QString) -> Self

Constructs a QUrl from a QString

source§

impl From<&String> for QUrl

source§

fn from(str: &String) -> Self

Constructs a QUrl from a Rust string

Note that this converts from UTF-8 to UTF-16

source§

impl From<&str> for QUrl

source§

fn from(str: &str) -> Self

Constructs a QUrl from a Rust string

Note that this converts from UTF-8 to UTF-16

source§

impl PartialEq for QUrl

source§

fn eq(&self, other: &Self) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl QListElement for QUrl

§

type TypeId = (Q, L, i, s, t, __, Q, U, r, l)

source§

fn append(list: &mut QList<Self>, value: Self)

source§

fn append_clone(list: &mut QList<Self>, value: &Self)

source§

fn clear(list: &mut QList<Self>)

source§

fn clone(list: &QList<Self>) -> QList<Self>

source§

fn contains(list: &QList<Self>, value: &Self) -> bool

source§

fn default() -> QList<Self>

source§

fn drop(list: &mut QList<Self>)

source§

unsafe fn get_unchecked(list: &QList<Self>, pos: isize) -> &Self

Safety Read more
source§

fn index_of(list: &QList<Self>, value: &Self) -> isize

source§

fn insert(list: &mut QList<Self>, pos: isize, value: Self)

source§

fn insert_clone(list: &mut QList<Self>, pos: isize, value: &Self)

source§

fn len(list: &QList<Self>) -> isize

source§

fn remove(list: &mut QList<Self>, pos: isize)

source§

fn reserve(list: &mut QList<Self>, size: isize)

source§

impl QSetElement for QUrl

§

type TypeId = (Q, S, e, t, __, Q, U, r, l)

source§

fn clear(set: &mut QSet<Self>)

source§

fn clone(set: &QSet<Self>) -> QSet<Self>

source§

fn contains(set: &QSet<Self>, value: &Self) -> bool

source§

fn default() -> QSet<Self>

source§

fn drop(set: &mut QSet<Self>)

source§

unsafe fn get_unchecked(set: &QSet<Self>, pos: isize) -> &Self

Safety Read more
source§

fn insert(set: &mut QSet<Self>, value: Self)

source§

fn insert_clone(set: &mut QSet<Self>, value: &Self)

source§

fn len(set: &QSet<Self>) -> isize

source§

fn remove(set: &mut QSet<Self>, value: &Self) -> bool

source§

impl QVariantValue for QUrl

source§

impl QVectorElement for QUrl

§

type TypeId = (Q, V, e, c, t, o, r, __, Q, U, r, l)

source§

fn append(vector: &mut QVector<Self>, value: Self)

source§

fn append_clone(vector: &mut QVector<Self>, value: &Self)

source§

fn clear(vector: &mut QVector<Self>)

source§

fn clone(vector: &QVector<Self>) -> QVector<Self>

source§

fn contains(vector: &QVector<Self>, value: &Self) -> bool

source§

fn default() -> QVector<Self>

source§

fn drop(vector: &mut QVector<Self>)

source§

unsafe fn get_unchecked(vector: &QVector<Self>, pos: isize) -> &Self

Safety Read more
source§

fn index_of(vector: &QVector<Self>, value: &Self) -> isize

source§

fn insert(vector: &mut QVector<Self>, pos: isize, value: Self)

source§

fn insert_clone(vector: &mut QVector<Self>, pos: isize, value: &Self)

source§

fn len(vector: &QVector<Self>) -> isize

source§

fn remove(vector: &mut QVector<Self>, pos: isize)

source§

fn reserve(vector: &mut QVector<Self>, size: isize)

source§

impl Eq for QUrl

Auto Trait Implementations§

§

impl Freeze for QUrl

§

impl RefUnwindSafe for QUrl

§

impl Send for QUrl

§

impl Sync for QUrl

§

impl Unpin for QUrl

§

impl UnwindSafe for QUrl

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T> ToString for T
where T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.