1// Copyright (C) 2022 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#ifndef QTENVIRONMENTVARIABLES_H
5#define QTENVIRONMENTVARIABLES_H
6
7#include <QtCore/qtconfigmacros.h>
8#include <QtCore/qtcoreexports.h>
9#include <QtCore/qtdeprecationmarkers.h>
10
11#if 0
12#pragma qt_class(QtEnvironmentVariables)
13#pragma qt_sync_stop_processing
14#endif
15
16QT_BEGIN_NAMESPACE
17
18class QByteArray;
19class QByteArrayView;
20class QString;
21
22Q_CORE_EXPORT QByteArray qgetenv(const char *varName);
23// need it as two functions because QString is only forward-declared here
24Q_CORE_EXPORT QString qEnvironmentVariable(const char *varName);
25Q_CORE_EXPORT QString qEnvironmentVariable(const char *varName, const QString &defaultValue);
26#if QT_CORE_REMOVED_SINCE(6, 5)
27Q_CORE_EXPORT bool qputenv(const char *varName, const QByteArray &value);
28#endif
29Q_CORE_EXPORT bool qputenv(const char *varName, QByteArrayView value);
30Q_CORE_EXPORT bool qunsetenv(const char *varName);
31
32Q_CORE_EXPORT bool qEnvironmentVariableIsEmpty(const char *varName) noexcept;
33Q_CORE_EXPORT bool qEnvironmentVariableIsSet(const char *varName) noexcept;
34Q_CORE_EXPORT int qEnvironmentVariableIntValue(const char *varName, bool *ok=nullptr) noexcept;
35
36QT_END_NAMESPACE
37
38#endif /* QTENVIRONMENTVARIABLES_H */
39

source code of qtbase/src/corelib/global/qtenvironmentvariables.h