#[repr(C)]
pub struct QProcessEnvironment { /* private fields */ }
Expand description

The QProcessEnvironment class holds the environment variables that can be passed to a program.

C++ class: QProcessEnvironment.

C++ documentation:

The QProcessEnvironment class holds the environment variables that can be passed to a program.

A process's environment is composed of a set of key=value pairs known as environment variables. The QProcessEnvironment class wraps that concept and allows easy manipulation of those variables. It's meant to be used along with QProcess, to set the environment for child processes. It cannot be used to change the current process's environment.

The environment of the calling process can be obtained using QProcessEnvironment::systemEnvironment().

On Unix systems, the variable names are case-sensitive. Note that the Unix environment allows both variable names and contents to contain arbitrary binary data (except for the NUL character). QProcessEnvironment will preserve such variables, but does not support manipulating variables whose names or values cannot be encoded by the current locale settings (see QTextCodec::codecForLocale).

On Windows, the variable names are case-insensitive, but case-preserving. QProcessEnvironment behaves accordingly.

Implementations§

source§

impl QProcessEnvironment

source

pub unsafe fn clear(&self)

Removes all key=value pairs from this QProcessEnvironment object, making it empty.

Calls C++ function: void QProcessEnvironment::clear().

C++ documentation:

Removes all key=value pairs from this QProcessEnvironment object, making it empty.

See also isEmpty() and systemEnvironment().

source

pub unsafe fn contains(&self, name: impl CastInto<Ref<QString>>) -> bool

Returns true if the environment variable of name name is found in this QProcessEnvironment object.

Calls C++ function: bool QProcessEnvironment::contains(const QString& name) const.

C++ documentation:

Returns true if the environment variable of name name is found in this QProcessEnvironment object.

See also insert() and value().

source

pub unsafe fn copy_from( &self, other: impl CastInto<Ref<QProcessEnvironment>> ) -> Ref<QProcessEnvironment>

Copies the contents of the other QProcessEnvironment object into this one.

Calls C++ function: QProcessEnvironment& QProcessEnvironment::operator=(const QProcessEnvironment& other).

C++ documentation:

Copies the contents of the other QProcessEnvironment object into this one.

source

pub unsafe fn insert_2a( &self, name: impl CastInto<Ref<QString>>, value: impl CastInto<Ref<QString>> )

Inserts the environment variable of name name and contents value into this QProcessEnvironment object. If that variable already existed, it is replaced by the new value.

Calls C++ function: void QProcessEnvironment::insert(const QString& name, const QString& value).

C++ documentation:

Inserts the environment variable of name name and contents value into this QProcessEnvironment object. If that variable already existed, it is replaced by the new value.

On most systems, inserting a variable with no contents will have the same effect for applications as if the variable had not been set at all. However, to guarantee that there are no incompatibilities, to remove a variable, please use the remove() function.

See also contains(), remove(), and value().

source

pub unsafe fn insert_1a(&self, e: impl CastInto<Ref<QProcessEnvironment>>)

This is an overloaded function.

Calls C++ function: void QProcessEnvironment::insert(const QProcessEnvironment& e).

C++ documentation:

This is an overloaded function.

Inserts the contents of e in this QProcessEnvironment object. Variables in this object that also exist in e will be overwritten.

This function was introduced in Qt 4.8.

source

pub unsafe fn is_empty(&self) -> bool

Returns true if this QProcessEnvironment object is empty: that is there are no key=value pairs set.

Calls C++ function: bool QProcessEnvironment::isEmpty() const.

C++ documentation:

Returns true if this QProcessEnvironment object is empty: that is there are no key=value pairs set.

See also clear(), systemEnvironment(), and insert().

source

pub unsafe fn keys(&self) -> CppBox<QStringList>

Returns a list containing all the variable names in this QProcessEnvironment object.

Calls C++ function: QStringList QProcessEnvironment::keys() const.

C++ documentation:

Returns a list containing all the variable names in this QProcessEnvironment object.

This function was introduced in Qt 4.8.

source

pub unsafe fn new() -> CppBox<QProcessEnvironment>

Creates a new QProcessEnvironment object. This constructor creates an empty environment. If set on a QProcess, this will cause the current environment variables to be removed.

Calls C++ function: [constructor] void QProcessEnvironment::QProcessEnvironment().

C++ documentation:

Creates a new QProcessEnvironment object. This constructor creates an empty environment. If set on a QProcess, this will cause the current environment variables to be removed.

source

pub unsafe fn new_copy( other: impl CastInto<Ref<QProcessEnvironment>> ) -> CppBox<QProcessEnvironment>

Creates a QProcessEnvironment object that is a copy of other.

Calls C++ function: [constructor] void QProcessEnvironment::QProcessEnvironment(const QProcessEnvironment& other).

C++ documentation:

Creates a QProcessEnvironment object that is a copy of other.

source

pub unsafe fn remove(&self, name: impl CastInto<Ref<QString>>)

Removes the environment variable identified by name from this QProcessEnvironment object. If that variable did not exist before, nothing happens.

Calls C++ function: void QProcessEnvironment::remove(const QString& name).

C++ documentation:

Removes the environment variable identified by name from this QProcessEnvironment object. If that variable did not exist before, nothing happens.

See also contains(), insert(), and value().

source

pub unsafe fn swap(&self, other: impl CastInto<Ref<QProcessEnvironment>>)

Swaps this process environment instance with other. This function is very fast and never fails.

Calls C++ function: void QProcessEnvironment::swap(QProcessEnvironment& other).

C++ documentation:

Swaps this process environment instance with other. This function is very fast and never fails.

This function was introduced in Qt 5.0.

source

pub unsafe fn system_environment() -> CppBox<QProcessEnvironment>

The systemEnvironment function returns the environment of the calling process.

Calls C++ function: static QProcessEnvironment QProcessEnvironment::systemEnvironment().

C++ documentation:

The systemEnvironment function returns the environment of the calling process.

It is returned as a QProcessEnvironment. This function does not cache the system environment. Therefore, it's possible to obtain an updated version of the environment if low-level C library functions like setenv or putenv have been called.

However, note that repeated calls to this function will recreate the QProcessEnvironment object, which is a non-trivial operation.

This function was introduced in Qt 4.6.

See also QProcess::systemEnvironment().

source

pub unsafe fn to_string_list(&self) -> CppBox<QStringList>

Converts this QProcessEnvironment object into a list of strings, one for each environment variable that is set. The environment variable's name and its value are separated by an equal character ('=').

Calls C++ function: QStringList QProcessEnvironment::toStringList() const.

C++ documentation:

Converts this QProcessEnvironment object into a list of strings, one for each environment variable that is set. The environment variable’s name and its value are separated by an equal character (‘=’).

The QStringList contents returned by this function are suitable for presentation. Use with the QProcess::setEnvironment function is not recommended due to potential encoding problems under Unix, and worse performance.

See also systemEnvironment(), QProcess::systemEnvironment(), and QProcess::setProcessEnvironment().

source

pub unsafe fn value_2a( &self, name: impl CastInto<Ref<QString>>, default_value: impl CastInto<Ref<QString>> ) -> CppBox<QString>

Searches this QProcessEnvironment object for a variable identified by name and returns its value. If the variable is not found in this object, then defaultValue is returned instead.

Calls C++ function: QString QProcessEnvironment::value(const QString& name, const QString& defaultValue = …) const.

C++ documentation:

Searches this QProcessEnvironment object for a variable identified by name and returns its value. If the variable is not found in this object, then defaultValue is returned instead.

See also contains(), insert(), and remove().

source

pub unsafe fn value_1a( &self, name: impl CastInto<Ref<QString>> ) -> CppBox<QString>

Searches this QProcessEnvironment object for a variable identified by name and returns its value. If the variable is not found in this object, then defaultValue is returned instead.

Calls C++ function: QString QProcessEnvironment::value(const QString& name) const.

C++ documentation:

Searches this QProcessEnvironment object for a variable identified by name and returns its value. If the variable is not found in this object, then defaultValue is returned instead.

See also contains(), insert(), and remove().

Trait Implementations§

source§

impl CppDeletable for QProcessEnvironment

source§

unsafe fn delete(&self)

Frees the resources associated with this QProcessEnvironment object.

Calls C++ function: [destructor] void QProcessEnvironment::~QProcessEnvironment().

C++ documentation:

Frees the resources associated with this QProcessEnvironment object.

source§

impl PartialEq<Ref<QProcessEnvironment>> for QProcessEnvironment

source§

fn eq(&self, other: &Ref<QProcessEnvironment>) -> bool

Returns true if this and the other QProcessEnvironment objects are equal.

Calls C++ function: bool QProcessEnvironment::operator==(const QProcessEnvironment& other) const.

C++ documentation:

Returns true if this and the other QProcessEnvironment objects are equal.

Two QProcessEnvironment objects are considered equal if they have the same set of key=value pairs. The comparison of keys is done case-sensitive on platforms where the environment is case-sensitive.

See also operator!=() and contains().

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.

Auto Trait Implementations§

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, U> CastInto<U> for T
where U: CastFrom<T>,

source§

unsafe fn cast_into(self) -> U

Performs the conversion. 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> StaticUpcast<T> for T

source§

unsafe fn static_upcast(ptr: Ptr<T>) -> Ptr<T>

Convert type of a const pointer. 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.