Make QProcessEnvironment(Initialization) noexcept

Use default noexcept constructor to initialize `d` member.
Document Initialization enum.

Fixes: QTBUG-100695
Pick-to: 6.3
Change-Id: I7585ad154a9be40021a205b515ffa7b14f188d67
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
This commit is contained in:
Ievgenii Meshcheriakov 2022-02-10 15:31:09 +01:00
parent 5958c28d9f
commit 4082fe8a39
2 changed files with 16 additions and 4 deletions

View File

@ -147,16 +147,28 @@ void QProcessEnvironmentPrivate::insert(const QProcessEnvironmentPrivate &other)
#endif
}
/*!
\enum QProcessEnvironment::Initialization
This enum contains a token that is used to disambiguate constructors.
\value InheritFromParent A QProcessEnvironment will be created that, when
set on a QProcess, causes it to inherit variables from its parent.
\since 6.3
*/
/*!
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.
environment variables to be removed (except for PATH and SystemRoot
on Windows).
*/
QProcessEnvironment::QProcessEnvironment() : d(new QProcessEnvironmentPrivate) { }
/*!
Creates an object that when set on QProcess will cause it to be executed with
environment variables inherited from the parent process.
environment variables inherited from its parent process.
\note The created object does not store any environment variables by itself,
it just indicates to QProcess to arrange for inheriting the environment at the
@ -172,7 +184,7 @@ QProcessEnvironment::QProcessEnvironment() : d(new QProcessEnvironmentPrivate) {
\sa inheritsFromParent(), systemEnvironment()
\since 6.3
*/
QProcessEnvironment::QProcessEnvironment(QProcessEnvironment::Initialization) : d(nullptr) { }
QProcessEnvironment::QProcessEnvironment(QProcessEnvironment::Initialization) noexcept { }
/*!
Frees the resources associated with this QProcessEnvironment object.

View File

@ -68,7 +68,7 @@ public:
enum Initialization { InheritFromParent };
QProcessEnvironment();
QProcessEnvironment(Initialization);
QProcessEnvironment(Initialization) noexcept;
QProcessEnvironment(const QProcessEnvironment &other);
~QProcessEnvironment();
QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_PURE_SWAP(QProcessEnvironment)