vcs
vcslocation.h
00001 /* This file is part of KDevelop 00002 * 00003 * Copyright 2007 Andreas Pakulat <apaku@gmx.de> 00004 * Copyright 2007 Matthew Woehlke <mw_triad@users.sourceforge.net> 00005 * 00006 * This program is free software; you can redistribute it and/or 00007 * modify it under the terms of the GNU General Public License 00008 * as published by the Free Software Foundation; either version 2 00009 * of the License, or (at your option) any later version. 00010 * 00011 * This program is distributed in the hope that it will be useful, 00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00014 * GNU General Public License for more details. 00015 * 00016 * You should have received a copy of the GNU General Public License 00017 * along with this program; if not, write to the Free Software 00018 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 00019 * 02110-1301, USA. 00020 */ 00021 00022 #ifndef KDEVVCSLOCATION_H 00023 #define KDEVVCSLOCATION_H 00024 00025 #include "vcsexport.h" 00026 #include <QtCore/QList> 00027 #include <kurl.h> 00028 00029 00030 namespace KDevelop 00031 { 00038 class KDEVPLATFORMVCS_EXPORT VcsLocation 00039 { 00040 public: 00041 enum LocationType 00042 { 00043 LocalLocation = 0 , 00044 RepositoryLocation = 1 00045 }; 00046 00047 VcsLocation(); 00048 VcsLocation( const KUrl& ); 00049 VcsLocation( const QString& ); 00050 ~VcsLocation(); 00051 VcsLocation( const VcsLocation& ); 00052 VcsLocation& operator=( const VcsLocation& ); 00053 00057 KUrl localUrl() const; 00058 00063 QString repositoryServer() const; 00068 QString repositoryModule() const; 00073 QString repositoryTag() const; 00078 QString repositoryBranch() const; 00084 QString repositoryPath() const; 00088 VcsLocation::LocationType type() const; 00089 00094 void setLocalUrl( const KUrl& url ); 00095 00099 void setRepositoryServer( const QString& ); 00103 void setRepositoryModule( const QString& ); 00107 void setRepositoryBranch( const QString& ); 00111 void setRepositoryTag( const QString& ); 00115 void setRepositoryPath( const QString& ); 00116 00122 void setUserData( const QVariant& ); 00123 00127 QVariant userData() const; 00128 00129 bool operator==( const KDevelop::VcsLocation& ); 00130 00131 bool isValid() const; 00132 00133 private: 00134 class VcsLocationPrivate* d; 00135 }; 00136 00137 inline uint qHash( const KDevelop::VcsLocation& loc ) 00138 { 00139 if( loc.type() == KDevelop::VcsLocation::LocalLocation ) 00140 { 00141 return qHash(loc.localUrl()); 00142 }else 00143 { 00144 return qHash(loc.repositoryServer()); 00145 } 00146 } 00147 00148 inline bool operator==( const KDevelop::VcsLocation& lhs, const KDevelop::VcsLocation& rhs ) 00149 { 00150 return( lhs.type() == rhs.type() 00151 && lhs.repositoryServer() == rhs.repositoryServer() 00152 && lhs.localUrl() == rhs.localUrl() ); 00153 } 00154 00155 } 00156 00157 Q_DECLARE_METATYPE( KDevelop::VcsLocation ) 00158 00159 #endif 00160
KDE 4.2 API Reference