KDb

KDbVersionInfo.shared.h
1/* This file is part of the KDE project
2 Copyright (C) 2003-2010 Jarosław Staniek <staniek@kde.org>
3
4 This program is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Library General Public
6 License as published by the Free Software Foundation; either
7 version 2 of the License, or (at your option) any later version.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Library General Public License for more details.
13
14 You should have received a copy of the GNU Library General Public License
15 along with this program; see the file COPYING. If not, write to
16 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 * Boston, MA 02110-1301, USA.
18*/
19
20#ifndef KDB_VERSIONINFO_H
21#define KDB_VERSIONINFO_H
22
23#include "kdb_export.h"
24#include <QString>
25#ifdef __GNUC__
26# include <sys/types.h> // We use minor/major identifiers, force this include
27 // to have "#define minor gnu_dev_minor" from sys/sysmacros.h
28 // and immediately undefine that; same for major.
29# undef minor
30# undef major
31#endif
32
33/*! Provides version information.
34
35 KDb::version() provides library version that can be compared to driver's plugin version
36 KDbDriverMetaData::version().
37
38 @note There is also KDbConnection::databaseVersion() that is retrieved from
39 database/connection properties.
40
41 @see KDbConnection::serverVersion()
42*/
43class KDB_EXPORT KDbVersionInfo //SDC: operator==
44{
45public:
46 /*!
47 @getter
48 @return major version number, e.g. 1 for 1.8.9
49 @setter
50 Sets the major version number.
51 */
52 int major; //SDC: default=0
53
54 /*!
55 @getter
56 @return minor version number, e.g. 8 for 1.8.9
57 @setter
58 Sets the minor version number.
59 */
60 int minor; //SDC: default=0
61
62 /*!
63 @getter
64 @return release version number, e.g. 9 for 1.8.9
65 @setter
66 Sets the release version number.
67 */
68 int release; //SDC: default=0
69
70 inline KDbVersionInfo(int majorVersion, int minorVersion, int releaseVersion)
71 : d(new Data)
72 {
73 d->major = majorVersion;
74 d->minor = minorVersion;
75 d->release = releaseVersion;
76 }
77
78 //! @return true if @a major and @a minor exatcly matches major and minor version of this info, respectively.
79 inline bool matches(int major, int minor) const { return major == d->major && minor == d->minor; }
80
81 //! @return true if this version info is null, i.e. all the version numbers are zero.
82 bool isNull() const;
83};
84
85/*! Provides information about version of given database backend.
86*/
87class KDB_EXPORT KDbServerVersionInfo //SDC: operator==
88{
89public:
90 /*!
91 @getter
92 @return major version number, e.g. 1 for 1.8.9
93 @setter
94 Sets the major version number.
95 */
96 int major; //SDC: default=0
97
98 /*!
99 @getter
100 @return minor version number, e.g. 8 for 1.8.9
101 @setter
102 Sets the minor version number.
103 */
104 int minor; //SDC: default=0
105
106 /*!
107 @getter
108 @return release version number, e.g. 9 for 1.8.9
109 @setter
110 Sets the release version number.
111 */
112 int release; //SDC: default=0
113
114 /*!
115 @getter
116 @return version string, as returned by the server.
117 @setter
118 Sets the version string, as returned by the server.
119 */
121
122 //! Clears the information - integers will be set to 0 and string to null
123 void clear();
124
125 //! @return true if this version info is null, i.e. all the version numbers are zero.
126 bool isNull() const;
127};
128
129#endif
bool matches(int major, int minor) const
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 4 2024 16:38:30 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.