File indexing completed on 2023-10-03 03:16:24
0001 /* This file is part of the KDE libraries 0002 Copyright (c) 2002 Simon Hausmann <hausmann@kde.org> 0003 Copyright (c) 2002 Marc Mutz <mutz@kde.org> 0004 Copyright (c) 2003 Andreas Beckermann <b_mann@gmx.de> 0005 0006 This library is free software; you can redistribute it and/or 0007 modify it under the terms of the GNU Library General Public 0008 License as published by the Free Software Foundation; either 0009 version 2 of the License, or (at your option) any later version. 0010 0011 This library is distributed in the hope that it will be useful, 0012 but WITHOUT ANY WARRANTY; without even the implied warranty of 0013 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 0014 Library General Public License for more details. 0015 0016 You should have received a copy of the GNU Library General Public License 0017 along with this library; see the file COPYING.LIB. If not, write to 0018 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 0019 Boston, MA 02110-1301, USA. 0020 */ 0021 0022 #ifndef KDELIBS_KDEVERSION_H 0023 #define KDELIBS_KDEVERSION_H 0024 0025 /** 0026 * @file kdeversion.h 0027 * @brief The file contains macros and functions related to the KDE version. 0028 */ 0029 0030 #include <kdelibs4support_export.h> 0031 #include <kdelibs4support_version.h> 0032 0033 /** 0034 * @def KDE_VERSION_STRING 0035 * @ingroup KDEMacros 0036 * @brief Version of KDE as string, at compile time 0037 * 0038 * This macro contains the KDE version in string form. As it is a macro, 0039 * it contains the version at compile time. See versionString() if you need 0040 * the KDE version used at runtime. 0041 * 0042 * @note The version string might contain a section in parentheses, 0043 * especially for development versions of KDE. 0044 * If you use that macro directly for a file format (e.g. OASIS Open Document) 0045 * or for a protocol (e.g. http) be careful that it is appropriate. 0046 * (Fictional) example: "4.0.90 (>=20070101)" 0047 */ 0048 #define KDE_VERSION_STRING KDELIBS4SUPPORT_VERSION_STRING 0049 0050 /** 0051 * @def KDE_VERSION_MAJOR 0052 * @ingroup KDEMacros 0053 * @brief Major version of KDE, at compile time 0054 */ 0055 #define KDE_VERSION_MAJOR KDELIBS4SUPPORT_VERSION_MAJOR 0056 /** 0057 * @def KDE_VERSION_MINOR 0058 * @ingroup KDEMacros 0059 * @brief Minor version of KDE, at compile time 0060 */ 0061 #define KDE_VERSION_MINOR KDELIBS4SUPPORT_VERSION_MINOR 0062 /** 0063 * @def KDE_VERSION_RELEASE 0064 * @ingroup KDEMacros 0065 * @brief Release version of KDE, at compile time 0066 */ 0067 #define KDE_VERSION_RELEASE KDELIBS4SUPPORT_VERSION_PATCH 0068 0069 /** 0070 * @ingroup KDEMacros 0071 * @brief Make a number from the major, minor and release number of a KDE version 0072 * 0073 * This function can be used for preprocessing when KDE_IS_VERSION is not 0074 * appropriate. 0075 */ 0076 #define KDE_MAKE_VERSION( a,b,c ) (((a) << 16) | ((b) << 8) | (c)) 0077 0078 /** 0079 * @ingroup KDEMacros 0080 * @brief Version of KDE as number, at compile time 0081 * 0082 * This macro contains the KDE version in number form. As it is a macro, 0083 * it contains the version at compile time. See version() if you need 0084 * the KDE version used at runtime. 0085 */ 0086 #define KDE_VERSION \ 0087 KDE_MAKE_VERSION(KDE_VERSION_MAJOR,KDE_VERSION_MINOR,KDE_VERSION_RELEASE) 0088 0089 /** 0090 * @ingroup KDEMacros 0091 * @brief Check if the KDE version matches a certain version or is higher 0092 * 0093 * This macro is typically used to compile conditionally a part of code: 0094 * @code 0095 * #if KDE_IS_VERSION(4,0,90) 0096 * // Code for KDE 4.1 0097 * #else 0098 * // Code for KDE 4.0 0099 * #endif 0100 * @endcode 0101 * 0102 * @warning Especially during development phases of KDE, be careful 0103 * when choosing the version number that you are checking against. 0104 * Otherwise you might risk to break the next KDE release. 0105 * Therefore be careful that development version have a 0106 * version number lower than the released version, so do not check 0107 * e.g. for KDE 4.1 with KDE_IS_VERSION(4,1,0) 0108 * but with the actual version number at a time a needed feature was introduced. 0109 */ 0110 #define KDE_IS_VERSION(a,b,c) ( KDE_VERSION >= KDE_MAKE_VERSION(a,b,c) ) 0111 0112 /** 0113 * Namespace for general KDE functions. 0114 */ 0115 namespace KDE 0116 { 0117 /** 0118 * @brief Returns the encoded number of KDE's version, see the KDE_VERSION macro. 0119 * 0120 * In contrary to the macro KDE_VERSION 0121 * this function returns the number of the actually 0122 * installed KDE version, not the number of the KDE version that was 0123 * installed when the program was compiled. 0124 * @return the version number, encoded in a single uint 0125 */ 0126 KDELIBS4SUPPORT_DEPRECATED_EXPORT unsigned int version(); 0127 /** 0128 * @brief Returns the major number of KDE's version, e.g. 0129 * 4 for KDE 4.1.2. 0130 * @return the major version number 0131 */ 0132 KDELIBS4SUPPORT_DEPRECATED_EXPORT unsigned int versionMajor(); 0133 /** 0134 * @brief Returns the minor number of KDE's version, e.g. 0135 * 1 for KDE 4.1.2. 0136 * @return the minor version number 0137 */ 0138 KDELIBS4SUPPORT_DEPRECATED_EXPORT unsigned int versionMinor(); 0139 /** 0140 * @brief Returns the release of KDE's version, e.g. 0141 * 2 for KDE 4.1.2. 0142 * @return the release number 0143 */ 0144 KDELIBS4SUPPORT_DEPRECATED_EXPORT unsigned int versionRelease(); 0145 /** 0146 * @brief Returns the KDE version as string, e.g. "4.1.2". 0147 * 0148 * On contrary to the macro KDE_VERSION_STRING this function returns 0149 * the version number of KDE at runtime. 0150 * @return the KDE version. You can keep the string forever 0151 */ 0152 KDELIBS4SUPPORT_DEPRECATED_EXPORT const char *versionString(); 0153 } 0154 0155 #endif // KDELIBS_KDEVERSION_H