File indexing completed on 2024-04-28 05:42:11

0001 /***************************************************************************
0002  *   Copyright (C) 2006-2009 by Rajko Albrecht                             *
0003  *   ral@alwins-world.de                                                   *
0004  *                                                                         *
0005  * This program is free software; you can redistribute it and/or           *
0006  * modify it under the terms of the GNU Lesser General Public              *
0007  * License as published by the Free Software Foundation; either            *
0008  * version 2.1 of the License, or (at your option) any later version.      *
0009  *                                                                         *
0010  * This program is distributed in the hope that it will be useful,         *
0011  * but WITHOUT ANY WARRANTY; without even the implied warranty of          *
0012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU       *
0013  * Lesser General Public License for more details.                         *
0014  *                                                                         *
0015  * You should have received a copy of the GNU Lesser General Public        *
0016  * License along with this program (in the file LGPL.txt); if not,         *
0017  * write to the Free Software Foundation, Inc., 51 Franklin St,            *
0018  * Fifth Floor, Boston, MA  02110-1301  USA                                *
0019  *                                                                         *
0020  * This software consists of voluntary contributions made by many          *
0021  * individuals.  For exact contribution history, see the revision          *
0022  * history and logs, available at https://commits.kde.org/kdesvn.          *
0023  ***************************************************************************/
0024 #include "version_check.h"
0025 
0026 #include <svn_client.h>
0027 #include <svn_version.h>
0028 
0029 #include <QString>
0030 
0031 namespace svn
0032 {
0033 static const svn_version_t Linkedtag = {SVN_VER_MAJOR, SVN_VER_MINOR, SVN_VER_PATCH, SVN_VER_NUMTAG};
0034 
0035 bool Version::client_version_compatible()
0036 {
0037     return svn_ver_compatible(svn_client_version(), &Linkedtag);
0038 }
0039 
0040 const QString Version::linked_version()
0041 {
0042     return QLatin1String(SVN_VERSION);
0043 }
0044 
0045 const QString Version::running_version()
0046 {
0047     static QString curr_version_string;
0048     if (curr_version_string.isEmpty()) {
0049         curr_version_string = QString(QLatin1String("%1.%2.%3.%4"))
0050                                   .arg(svn_client_version()->major)
0051                                   .arg(svn_client_version()->minor)
0052                                   .arg(svn_client_version()->patch)
0053                                   .arg(QString::fromUtf8(svn_client_version()->tag));
0054     }
0055     return curr_version_string;
0056 }
0057 
0058 int Version::version_major()
0059 {
0060     return svn_client_version()->major;
0061 }
0062 
0063 int Version::version_minor()
0064 {
0065     return svn_client_version()->minor;
0066 }
0067 }