File indexing completed on 2024-11-10 04:15:57
0001 /* This file is part of the KDE project 0002 Copyright (C) 2003-2010 Jarosław Staniek <staniek@kde.org> 0003 0004 This program is free software; you can redistribute it and/or 0005 modify it under the terms of the GNU Library General Public 0006 License as published by the Free Software Foundation; either 0007 version 2 of the License, or (at your option) any later version. 0008 0009 This program is distributed in the hope that it will be useful, 0010 but WITHOUT ANY WARRANTY; without even the implied warranty of 0011 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 0012 Library General Public License for more details. 0013 0014 You should have received a copy of the GNU Library General Public License 0015 along with this program; see the file COPYING. If not, write to 0016 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 0017 * Boston, MA 02110-1301, USA. 0018 */ 0019 0020 #ifndef KDB_VERSIONINFO_H 0021 #define KDB_VERSIONINFO_H 0022 0023 #include "kdb_export.h" 0024 #include <QString> 0025 #ifdef __GNUC__ 0026 # include <sys/types.h> // We use minor/major identifiers, force this include 0027 // to have "#define minor gnu_dev_minor" from sys/sysmacros.h 0028 // and immediately undefine that; same for major. 0029 # undef minor 0030 # undef major 0031 #endif 0032 0033 /*! Provides version information. 0034 0035 KDb::version() provides library version that can be compared to driver's plugin version 0036 KDbDriverMetaData::version(). 0037 0038 @note There is also KDbConnection::databaseVersion() that is retrieved from 0039 database/connection properties. 0040 0041 @see KDbConnection::serverVersion() 0042 */ 0043 class KDB_EXPORT KDbVersionInfo //SDC: operator== 0044 { 0045 public: 0046 /*! 0047 @getter 0048 @return major version number, e.g. 1 for 1.8.9 0049 @setter 0050 Sets the major version number. 0051 */ 0052 int major; //SDC: default=0 0053 0054 /*! 0055 @getter 0056 @return minor version number, e.g. 8 for 1.8.9 0057 @setter 0058 Sets the minor version number. 0059 */ 0060 int minor; //SDC: default=0 0061 0062 /*! 0063 @getter 0064 @return release version number, e.g. 9 for 1.8.9 0065 @setter 0066 Sets the release version number. 0067 */ 0068 int release; //SDC: default=0 0069 0070 inline KDbVersionInfo(int majorVersion, int minorVersion, int releaseVersion) 0071 : d(new Data) 0072 { 0073 d->major = majorVersion; 0074 d->minor = minorVersion; 0075 d->release = releaseVersion; 0076 } 0077 0078 //! @return true if @a major and @a minor exatcly matches major and minor version of this info, respectively. 0079 inline bool matches(int major, int minor) const { return major == d->major && minor == d->minor; } 0080 0081 //! @return true if this version info is null, i.e. all the version numbers are zero. 0082 bool isNull() const; 0083 }; 0084 0085 /*! Provides information about version of given database backend. 0086 */ 0087 class KDB_EXPORT KDbServerVersionInfo //SDC: operator== 0088 { 0089 public: 0090 /*! 0091 @getter 0092 @return major version number, e.g. 1 for 1.8.9 0093 @setter 0094 Sets the major version number. 0095 */ 0096 int major; //SDC: default=0 0097 0098 /*! 0099 @getter 0100 @return minor version number, e.g. 8 for 1.8.9 0101 @setter 0102 Sets the minor version number. 0103 */ 0104 int minor; //SDC: default=0 0105 0106 /*! 0107 @getter 0108 @return release version number, e.g. 9 for 1.8.9 0109 @setter 0110 Sets the release version number. 0111 */ 0112 int release; //SDC: default=0 0113 0114 /*! 0115 @getter 0116 @return version string, as returned by the server. 0117 @setter 0118 Sets the version string, as returned by the server. 0119 */ 0120 QString string; //SDC: 0121 0122 //! Clears the information - integers will be set to 0 and string to null 0123 void clear(); 0124 0125 //! @return true if this version info is null, i.e. all the version numbers are zero. 0126 bool isNull() const; 0127 }; 0128 0129 #endif