KPackage

version.cpp
1 /*
2  SPDX-FileCopyrightText: 2008 Aaron Seigo <[email protected]>
3 
4  SPDX-License-Identifier: LGPL-2.0-or-later
5 */
6 
7 #include <kpackage/version.h>
8 
9 #if KPACKAGE_BUILD_DEPRECATED_SINCE(5, 84)
10 
11 #include "kpackage_debug.h"
12 
13 namespace KPackage
14 {
15 unsigned int version()
16 {
17  return PACKAGE_VERSION;
18 }
19 
20 unsigned int versionMajor()
21 {
22  return PACKAGE_VERSION_MAJOR;
23 }
24 
25 unsigned int versionMinor()
26 {
27  return PACKAGE_VERSION_MINOR;
28 }
29 
30 unsigned int versionRelease()
31 {
32  return PACKAGE_VERSION_PATCH;
33 }
34 
35 const char *versionString()
36 {
37  return PACKAGE_VERSION_STRING;
38 }
39 
41 {
42  if (version == quint32(-1)) {
43  // unversioned, just let it through
44  qCWarning(KPACKAGE_LOG) << "unversioned plugin detected, may result in instability";
45  return true;
46  }
47 
48  // we require PACKAGE_VERSION_MAJOR and PACKAGE_VERSION_MINOR
49  const quint32 minVersion = PACKAGE_MAKE_VERSION(PACKAGE_VERSION_MAJOR, 0, 0);
50  const quint32 maxVersion = PACKAGE_MAKE_VERSION(PACKAGE_VERSION_MAJOR, PACKAGE_VERSION_MINOR, 60);
51 
52  if (version < minVersion || version > maxVersion) {
53 #ifndef NDEBUG
54  // qCDebug(KPACKAGE_LOG) << "plugin is compiled against incompatible KPackage version " << version
55  // << "This build is compatible with" << PACKAGE_VERSION_MAJOR << ".0.0 (" << minVersion
56  // << ") to" << PACKAGE_VERSION_STRING << "(" << maxVersion << ")";
57 #endif
58  return false;
59  }
60 
61  return true;
62 }
63 
64 } // namespace
65 #endif
unsigned int version()
The runtime version of libkpackage.
Definition: version.cpp:15
bool isPluginVersionCompatible(unsigned int version)
Verifies that a plugin is compatible with plasma.
Definition: version.cpp:40
const char * versionString()
The runtime version string of libkpackage.
Definition: version.cpp:35
unsigned int versionRelease()
The runtime major version of libkpackage.
Definition: version.cpp:30
unsigned int versionMajor()
The runtime major version of libkpackage.
Definition: version.cpp:20
unsigned int versionMinor()
The runtime major version of libkpackage.
Definition: version.cpp:25
Namespace for everything in kpackage.
Definition: package.cpp:33
<KPackage/Version>
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Mon Dec 6 2021 22:46:26 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.