1/* This file is part of the KDE libraries
2 Copyright (c) 2002 Simon Hausmann <hausmann@kde.org>
3 Copyright (c) 2002 Marc Mutz <mutz@kde.org>
4 Copyright (c) 2003 Andreas Beckermann <b_mann@gmx.de>
6 This library is free software; you can redistribute it and/or
7 modify it under the terms of the GNU Library General Public
8 License as published by the Free Software Foundation; either
9 version 2 of the License, or (at your option) any later version.
11 This library is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 Library General Public License for more details.
16 You should have received a copy of the GNU Library General Public License
17 along with this library; see the file COPYING.LIB. If not, write to
18 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19 Boston, MA 02110-1301, USA.
22#ifndef KDELIBS_KDEVERSION_H
23#define KDELIBS_KDEVERSION_H
27 * @brief The file contains macros and functions related to the KDE version.
30#include <kdecore_export.h>
33 * @def KDE_VERSION_STRING
35 * @brief Version of KDE as string, at compile time
37 * This macro contains the KDE version in string form. As it is a macro,
38 * it contains the version at compile time. See versionString() if you need
39 * the KDE version used at runtime.
41 * @note The version string might contain a section in parentheses,
42 * especially for development versions of KDE.
43 * If you use that macro directly for a file format (e.g. OASIS Open Document)
44 * or for a protocol (e.g. http) be careful that it is appropriate.
45 * (Fictional) example: "4.0.90 (>=20070101)"
47#define KDE_VERSION_STRING "${KDE_VERSION_STRING}"
50 * @def KDE_VERSION_MAJOR
52 * @brief Major version of KDE, at compile time
54#define KDE_VERSION_MAJOR ${KDE_VERSION_MAJOR}
56 * @def KDE_VERSION_MINOR
58 * @brief Minor version of KDE, at compile time
60#define KDE_VERSION_MINOR ${KDE_VERSION_MINOR}
62 * @def KDE_VERSION_RELEASE
64 * @brief Release version of KDE, at compile time
66#define KDE_VERSION_RELEASE ${KDE_VERSION_RELEASE}
70 * @brief Make a number from the major, minor and release number of a KDE version
72 * This function can be used for preprocessing when KDE_IS_VERSION is not
75#define KDE_MAKE_VERSION( a,b,c ) (((a) << 16) | ((b) << 8) | (c))
79 * @brief Version of KDE as number, at compile time
81 * This macro contains the KDE version in number form. As it is a macro,
82 * it contains the version at compile time. See version() if you need
83 * the KDE version used at runtime.
86 KDE_MAKE_VERSION(KDE_VERSION_MAJOR,KDE_VERSION_MINOR,KDE_VERSION_RELEASE)
90 * @brief Check if the KDE version matches a certain version or is higher
92 * This macro is typically used to compile conditionally a part of code:
94 * #if KDE_IS_VERSION(4,0,90)
101 * @warning Especially during development phases of KDE, be careful
102 * when choosing the version number that you are checking against.
103 * Otherwise you might risk to break the next KDE release.
104 * Therefore be careful that development version have a
105 * version number lower than the released version, so do not check
106 * e.g. for KDE 4.1 with KDE_IS_VERSION(4,1,0)
107 * but with the actual version number at a time a needed feature was introduced.
109#define KDE_IS_VERSION(a,b,c) ( KDE_VERSION >= KDE_MAKE_VERSION(a,b,c) )
112 * Namespace for general KDE functions.
117 * @brief Returns the encoded number of KDE's version, see the KDE_VERSION macro.
119 * In contrary to the macro KDE_VERSION
120 * this function returns the number of the actually
121 * installed KDE version, not the number of the KDE version that was
122 * installed when the program was compiled.
123 * @return the version number, encoded in a single uint
125 KDECORE_EXPORT unsigned int version();
127 * @brief Returns the major number of KDE's version, e.g.
129 * @return the major version number
131 KDECORE_EXPORT unsigned int versionMajor();
133 * @brief Returns the minor number of KDE's version, e.g.
135 * @return the minor version number
137 KDECORE_EXPORT unsigned int versionMinor();
139 * @brief Returns the release of KDE's version, e.g.
141 * @return the release number
143 KDECORE_EXPORT unsigned int versionRelease();
145 * @brief Returns the KDE version as string, e.g. "4.1.2".
147 * On contrary to the macro KDE_VERSION_STRING this function returns
148 * the version number of KDE at runtime.
149 * @return the KDE version. You can keep the string forever
151 KDECORE_EXPORT const char *versionString();
154#endif // KDELIBS_KDEVERSION_H