File indexing completed on 2024-04-21 15:30:06

0001 /* This file is part of the KDE project
0002    Copyright (C) 2003-2015 Jarosław Staniek <staniek@kde.org>
0003 
0004    Portions of kstandarddirs.cpp:
0005    Copyright (C) 1999 Sirtaj Singh Kang <taj@kde.org>
0006    Copyright (C) 1999,2007 Stephan Kulow <coolo@kde.org>
0007    Copyright (C) 1999 Waldo Bastian <bastian@kde.org>
0008    Copyright (C) 2009 David Faure <faure@kde.org>
0009 
0010    This program is free software; you can redistribute it and/or
0011    modify it under the terms of the GNU Library General Public
0012    License as published by the Free Software Foundation; either
0013    version 2 of the License, or (at your option) any later version.
0014 
0015    This program is distributed in the hope that it will be useful,
0016    but WITHOUT ANY WARRANTY; without even the implied warranty of
0017    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0018    Library General Public License for more details.
0019 
0020    You should have received a copy of the GNU Library General Public License
0021    along with this program; see the file COPYING.  If not, write to
0022    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
0023  * Boston, MA 02110-1301, USA.
0024 */
0025 
0026 #ifndef KDB_TOOLS_UTILS_P_H
0027 #define KDB_TOOLS_UTILS_P_H
0028 
0029 #include <QtGlobal>
0030 
0031 #if QT_VERSION < 0x050700
0032 //! @internal for qAsConst()
0033 template <typename T> struct QAddConst {
0034     typedef const T Type;
0035 };
0036 
0037 //! Adds const to non-const objects (like std::as_const)
0038 template <typename T>
0039 Q_DECL_CONSTEXPR typename QAddConst<T>::Type& qAsConst(T& t) Q_DECL_NOTHROW { return t; }
0040 
0041 // prevent rvalue arguments:
0042 template <typename T>
0043 void qAsConst(const T &&) Q_DECL_EQ_DELETE;
0044 #endif // QT_VERSION < 0x050700
0045 
0046 //! @def KDB_SHARED_LIB_EXTENSION operating system-dependent extension for shared library files
0047 #if defined(Q_OS_WIN)
0048 #define KDB_SHARED_LIB_EXTENSION ".dll"
0049 #elif defined(Q_OS_MACOS)
0050 // shared libraries indeed have a dylib extension on OS X, but most apps use .so for plugins
0051 #define KDB_SHARED_LIB_EXTENSION ".so"
0052 #else
0053 #define KDB_SHARED_LIB_EXTENSION ".so"
0054 #endif
0055 
0056 #endif //KDB_TOOLS_UTILS_P_H