Warning, file /sdk/cervisia/misc.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 /*
0002  *  Copyright (C) 1999-2002 Bernd Gehrmann
0003  *                          bernd@mail.berlios.de
0004  *  Copyright (c) 2003 Christian Loose <christian.loose@hamburg.de>
0005  *
0006  * This program is free software; you can redistribute it and/or modify
0007  * it under the terms of the GNU General Public License as published by
0008  * the Free Software Foundation; either version 2 of the License, or
0009  * (at your option) any later version.
0010  *
0011  * This program is distributed in the hope that it will be useful,
0012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
0013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0014  * GNU General Public License for more details.
0015  *
0016  * You should have received a copy of the GNU General Public License
0017  * along with this program; if not, write to the Free Software
0018  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
0019  */
0020 
0021 #ifndef MISC_H
0022 #define MISC_H
0023 
0024 #include <QStringList>
0025 
0026 class QString;
0027 class QWidget;
0028 class OrgKdeCervisia5CvsserviceCvsserviceInterface;
0029 
0030 namespace Cervisia
0031 {
0032 
0033 /**
0034  * Verifies that the passed tag name is a valid cvs tag.
0035  */
0036 bool IsValidTag(const QString &tag);
0037 
0038 /**
0039  * Returns the user name (real name + mail address) for the changelog entry.
0040  */
0041 QString UserName();
0042 
0043 /**
0044  * This method makes sure that the cvsroot specification for a pserver repository has
0045  * always the form:
0046  *  :pserver:[user]@[host]:[port][path]
0047  */
0048 QString NormalizeRepository(const QString &repository);
0049 
0050 bool CheckOverwrite(const QString &fileName, QWidget *parent = nullptr);
0051 }
0052 
0053 QStringList splitLine(QString, char delim = ' ');
0054 
0055 QString tempFileName(const QString &suffix);
0056 void cleanupTempFiles();
0057 
0058 const QStringList fetchBranches(OrgKdeCervisia5CvsserviceCvsserviceInterface *cvsService, QWidget *parent);
0059 const QStringList fetchTags(OrgKdeCervisia5CvsserviceCvsserviceInterface *cvsService, QWidget *parent);
0060 
0061 /**
0062  * Compares two revision numbers.
0063  *
0064  * @return -1 / 0 / 1 if rev1 is < / == / > rev2
0065  */
0066 int compareRevisions(const QString &rev1, const QString &rev2);
0067 
0068 /**
0069  * Generic compare for two objects of the same class. operator<() must
0070  * be defined for this class.
0071  *
0072  * @return -1 / 0 / 1 if lhs is < / == / > rhs
0073  */
0074 template<class C>
0075 int compare(const C &lhs, const C &rhs)
0076 {
0077     if (lhs < rhs)
0078         return -1;
0079     else if (rhs < lhs)
0080         return 1;
0081     else
0082         return 0;
0083 }
0084 
0085 #endif
0086 
0087 // Local Variables:
0088 // c-basic-offset: 4
0089 // End: