2012-06-29 12:14:58 +00:00
|
|
|
/*
|
|
|
|
|
* Copyright (C) 2012 Felix Geyer <debfx@fobos.de>
|
|
|
|
|
* Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies)
|
|
|
|
|
* Copyright (C) 2012 Intel Corporation
|
|
|
|
|
*
|
|
|
|
|
* This program is free software: you can redistribute it and/or modify
|
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
|
* the Free Software Foundation, either version 2 or (at your option)
|
|
|
|
|
* version 3 of the License.
|
|
|
|
|
*
|
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
|
*
|
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#ifndef KEEPASSX_GLOBAL_H
|
|
|
|
|
#define KEEPASSX_GLOBAL_H
|
|
|
|
|
|
2019-11-24 16:10:40 +00:00
|
|
|
#include <QString>
|
2024-06-22 11:22:44 +00:00
|
|
|
#include <QTextStream>
|
2012-06-29 12:14:58 +00:00
|
|
|
|
2013-03-29 15:27:02 +00:00
|
|
|
#if defined(Q_OS_WIN)
|
2024-06-24 11:43:59 +00:00
|
|
|
#if defined(KPXC_BUILDING_CORE)
|
2021-02-14 03:13:10 +00:00
|
|
|
#define KEEPASSXC_EXPORT Q_DECL_IMPORT
|
2013-03-29 15:27:02 +00:00
|
|
|
#else
|
2021-02-14 03:13:10 +00:00
|
|
|
#define KEEPASSXC_EXPORT Q_DECL_EXPORT
|
2018-03-31 20:01:30 +00:00
|
|
|
#endif
|
|
|
|
|
#else
|
2021-02-14 03:13:10 +00:00
|
|
|
#define KEEPASSXC_EXPORT Q_DECL_EXPORT
|
2013-03-29 15:27:02 +00:00
|
|
|
#endif
|
|
|
|
|
|
2013-10-12 17:11:57 +00:00
|
|
|
#ifndef QUINT32_MAX
|
|
|
|
|
#define QUINT32_MAX 4294967295U
|
|
|
|
|
#endif
|
|
|
|
|
|
2019-11-08 23:05:37 +00:00
|
|
|
#if defined(Q_OS_WIN) || defined(Q_OS_MACOS)
|
|
|
|
|
#define FILE_CASE_SENSITIVE Qt::CaseInsensitive
|
|
|
|
|
#else
|
|
|
|
|
#define FILE_CASE_SENSITIVE Qt::CaseSensitive
|
|
|
|
|
#endif
|
|
|
|
|
|
2024-06-22 11:22:44 +00:00
|
|
|
#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0)
|
|
|
|
|
// "Backport" a few things to the 'Qt' namespace as required for older Qt
|
|
|
|
|
// versions.
|
|
|
|
|
namespace Qt
|
|
|
|
|
{
|
|
|
|
|
const QString::SplitBehavior SkipEmptyParts = QString::SkipEmptyParts;
|
|
|
|
|
inline QTextStream& endl(QTextStream& s)
|
|
|
|
|
{
|
|
|
|
|
return ::endl(s);
|
|
|
|
|
}
|
|
|
|
|
inline QTextStream& flush(QTextStream& s)
|
|
|
|
|
{
|
|
|
|
|
return ::flush(s);
|
|
|
|
|
}
|
|
|
|
|
} // namespace Qt
|
|
|
|
|
#endif
|
|
|
|
|
|
2019-11-24 16:10:40 +00:00
|
|
|
static const auto TRUE_STR = QStringLiteral("true");
|
|
|
|
|
static const auto FALSE_STR = QStringLiteral("false");
|
|
|
|
|
|
2021-02-05 20:07:59 +00:00
|
|
|
enum class AuthDecision
|
|
|
|
|
{
|
|
|
|
|
Undecided,
|
|
|
|
|
Allowed,
|
|
|
|
|
AllowedOnce,
|
|
|
|
|
Denied,
|
|
|
|
|
DeniedOnce,
|
|
|
|
|
};
|
|
|
|
|
|
2018-03-31 20:01:30 +00:00
|
|
|
template <typename T> struct AddConst
|
|
|
|
|
{
|
|
|
|
|
typedef const T Type;
|
|
|
|
|
};
|
2016-09-02 17:51:51 +00:00
|
|
|
|
|
|
|
|
// this adds const to non-const objects (like std::as_const)
|
2018-03-31 20:01:30 +00:00
|
|
|
template <typename T> constexpr typename AddConst<T>::Type& asConst(T& t) noexcept
|
|
|
|
|
{
|
|
|
|
|
return t;
|
|
|
|
|
}
|
2016-09-02 17:51:51 +00:00
|
|
|
// prevent rvalue arguments:
|
2018-03-31 20:01:30 +00:00
|
|
|
template <typename T> void asConst(const T&&) = delete;
|
2016-09-02 17:51:51 +00:00
|
|
|
|
2012-06-29 12:14:58 +00:00
|
|
|
#endif // KEEPASSX_GLOBAL_H
|