1 /*************************************************************************** 2 * Copyright (C) 2005-2009 by Rajko Albrecht ral@alwins-world.de * 3 * http://kdesvn.alwins-world.de/ * 4 * * 5 * This program is free software; you can redistribute it and/or * 6 * modify it under the terms of the GNU Lesser General Public * 7 * License as published by the Free Software Foundation; either * 8 * version 2.1 of the License, or (at your option) any later version. * 9 * * 10 * This program is distributed in the hope that it will be useful, * 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 13 * Lesser General Public License for more details. * 14 * * 15 * You should have received a copy of the GNU Lesser General Public * 16 * License along with this program (in the file LGPL.txt); if not, * 17 * write to the Free Software Foundation, Inc., 51 Franklin St, * 18 * Fifth Floor, Boston, MA 02110-1301 USA * 19 * * 20 * This software consists of voluntary contributions made by many * 21 * individuals. For exact contribution history, see the revision * 22 * history and logs, available at http://kdesvn.alwins-world.de. * 23 ***************************************************************************/ 24 #ifndef LOG_CACHE_H 25 #define LOG_CACHE_H 26 27 #include <QString> 28 #include <QDir> 29 #include <QVariant> 30 #include <QSqlDatabase> 31 32 #include "svnqt/svnqt_defines.h" 33 #include <QScopedPointer> 34 35 namespace svn 36 { 37 class Path; 38 namespace cache 39 { 40 41 class LogCacheData; 42 43 class SVNQT_EXPORT LogCache 44 { 45 private: 46 QScopedPointer<LogCacheData> m_CacheData; 47 48 protected: 49 LogCache(); 50 static LogCache *mSelf; 51 QString m_BasePath; 52 void setupCachePath(); 53 void setupMainDb(); 54 int databaseVersion()const; 55 void databaseVersion(int newversion); 56 57 public: 58 ///! should used for testing only! 59 explicit LogCache(const QString &aBasePath); 60 virtual ~LogCache(); 61 static LogCache *self(); 62 QSqlDatabase reposDb(const QString &aRepository); 63 QStringList cachedRepositories()const; 64 65 bool valid()const; 66 67 QVariant getRepositoryParameter(const svn::Path &repository, const QString &key)const; 68 //! set or delete parameter 69 /*! 70 * if value is invalid the parameter will removed from database 71 */ 72 bool setRepositoryParameter(const svn::Path &repository, const QString &key, const QVariant &value); 73 bool deleteRepository(const QString &aRepository); 74 }; 75 } 76 } 77 78 #endif 79