File indexing completed on 2024-05-12 05:44:35
0001 /*************************************************************************** 0002 * Copyright (C) 2005-2009 by Rajko Albrecht ral@alwins-world.de * 0003 * https://kde.org/applications/development/org.kde.kdesvn * 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 #ifndef LOG_CACHE_H 0025 #define LOG_CACHE_H 0026 0027 #include <QDir> 0028 #include <QSqlDatabase> 0029 #include <QString> 0030 #include <QVariant> 0031 0032 #include "svnqt/svnqt_defines.h" 0033 #include <QScopedPointer> 0034 0035 namespace svn 0036 { 0037 class Path; 0038 namespace cache 0039 { 0040 0041 class LogCacheData; 0042 0043 class SVNQT_EXPORT LogCache 0044 { 0045 private: 0046 QScopedPointer<LogCacheData> m_CacheData; 0047 0048 protected: 0049 LogCache(); 0050 static LogCache *mSelf; 0051 QString m_BasePath; 0052 void setupCachePath(); 0053 void setupMainDb(); 0054 int databaseVersion() const; 0055 void databaseVersion(int newversion); 0056 0057 public: 0058 ///! should used for testing only! 0059 explicit LogCache(const QString &aBasePath); 0060 virtual ~LogCache(); 0061 static LogCache *self(); 0062 QSqlDatabase reposDb(const QString &aRepository); 0063 QStringList cachedRepositories() const; 0064 0065 bool valid() const; 0066 0067 QVariant getRepositoryParameter(const svn::Path &repository, const QString &key) const; 0068 //! set or delete parameter 0069 /*! 0070 * if value is invalid the parameter will removed from database 0071 */ 0072 bool setRepositoryParameter(const svn::Path &repository, const QString &key, const QVariant &value); 0073 bool deleteRepository(const QString &aRepository); 0074 }; 0075 } 0076 } 0077 0078 #endif