• Skip to content
  • Skip to link menu
  • KDE API Reference
  • kdelibs-4.14.38 API Reference
  • KDE Home
  • Contact Us
 

KDECore

  • kdecore
  • util
kdeversion.h.cmake
Go to the documentation of this file.
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>
5
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.
10
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.
15
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.
20*/
21
22#ifndef KDELIBS_KDEVERSION_H
23#define KDELIBS_KDEVERSION_H
24
25/**
26 * @file kdeversion.h
27 * @brief The file contains macros and functions related to the KDE version.
28 */
29
30#include <kdecore_export.h>
31
32/**
33 * @def KDE_VERSION_STRING
34 * @ingroup KDEMacros
35 * @brief Version of KDE as string, at compile time
36 *
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.
40 *
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)"
46 */
47#define KDE_VERSION_STRING "${KDE_VERSION_STRING}"
48
49/**
50 * @def KDE_VERSION_MAJOR
51 * @ingroup KDEMacros
52 * @brief Major version of KDE, at compile time
53 */
54#define KDE_VERSION_MAJOR ${KDE_VERSION_MAJOR}
55/**
56 * @def KDE_VERSION_MINOR
57 * @ingroup KDEMacros
58 * @brief Minor version of KDE, at compile time
59 */
60#define KDE_VERSION_MINOR ${KDE_VERSION_MINOR}
61/**
62 * @def KDE_VERSION_RELEASE
63 * @ingroup KDEMacros
64 * @brief Release version of KDE, at compile time
65 */
66#define KDE_VERSION_RELEASE ${KDE_VERSION_RELEASE}
67
68/**
69 * @ingroup KDEMacros
70 * @brief Make a number from the major, minor and release number of a KDE version
71 *
72 * This function can be used for preprocessing when KDE_IS_VERSION is not
73 * appropriate.
74 */
75#define KDE_MAKE_VERSION( a,b,c ) (((a) << 16) | ((b) << 8) | (c))
76
77/**
78 * @ingroup KDEMacros
79 * @brief Version of KDE as number, at compile time
80 *
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.
84 */
85#define KDE_VERSION \
86 KDE_MAKE_VERSION(KDE_VERSION_MAJOR,KDE_VERSION_MINOR,KDE_VERSION_RELEASE)
87
88/**
89 * @ingroup KDEMacros
90 * @brief Check if the KDE version matches a certain version or is higher
91 *
92 * This macro is typically used to compile conditionally a part of code:
93 * @code
94 * #if KDE_IS_VERSION(4,0,90)
95 * // Code for KDE 4.1
96 * #else
97 * // Code for KDE 4.0
98 * #endif
99 * @endcode
100 *
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.
108 */
109#define KDE_IS_VERSION(a,b,c) ( KDE_VERSION >= KDE_MAKE_VERSION(a,b,c) )
110
111/**
112 * Namespace for general KDE functions.
113 */
114namespace KDE
115{
116 /**
117 * @brief Returns the encoded number of KDE's version, see the KDE_VERSION macro.
118 *
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
124 */
125 KDECORE_EXPORT unsigned int version();
126 /**
127 * @brief Returns the major number of KDE's version, e.g.
128 * 4 for KDE 4.1.2.
129 * @return the major version number
130 */
131 KDECORE_EXPORT unsigned int versionMajor();
132 /**
133 * @brief Returns the minor number of KDE's version, e.g.
134 * 1 for KDE 4.1.2.
135 * @return the minor version number
136 */
137 KDECORE_EXPORT unsigned int versionMinor();
138 /**
139 * @brief Returns the release of KDE's version, e.g.
140 * 2 for KDE 4.1.2.
141 * @return the release number
142 */
143 KDECORE_EXPORT unsigned int versionRelease();
144 /**
145 * @brief Returns the KDE version as string, e.g. "4.1.2".
146 *
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
150 */
151 KDECORE_EXPORT const char *versionString();
152}
153
154#endif // KDELIBS_KDEVERSION_H
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Mon Feb 20 2023 00:00:00 by doxygen 1.9.6 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

KDECore

Skip menu "KDECore"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Modules
  • Related Pages

kdelibs-4.14.38 API Reference

Skip menu "kdelibs-4.14.38 API Reference"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver
Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal