Add line for debugging
[kdevelopdvcssupport.git] / vcs / vcslocation.h
blob5173b1f184824b38fd69d7a52d2cce8d9c28fb8c
1 /* This file is part of KDevelop
3 * Copyright 2007 Andreas Pakulat <apaku@gmx.de>
4 * Copyright 2007 Matthew Woehlke <mw_triad@users.sourceforge.net>
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version 2
9 * of the License, or (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
19 * 02110-1301, USA.
22 #ifndef KDEVVCSLOCATION_H
23 #define KDEVVCSLOCATION_H
25 #include "vcsexport.h"
26 #include <QtCore/QList>
27 #include <kurl.h>
30 namespace KDevelop
32 /**
33 * Denotes a local or repository location for a Vcs system
35 * For the RepositoryLocation type most of the informations
36 * are vcs specific
38 class KDEVPLATFORMVCS_EXPORT VcsLocation
40 public:
41 enum LocationType
43 LocalLocation = 0 /**< this is a local location */,
44 RepositoryLocation = 1 /**< this is a repository location */
47 VcsLocation();
48 VcsLocation( const KUrl& );
49 VcsLocation( const QString& );
50 ~VcsLocation();
51 VcsLocation( const VcsLocation& );
52 VcsLocation& operator=( const VcsLocation& );
54 /**
55 * @returns Local url if this location is a LocalLocation
57 KUrl localUrl() const;
59 /**
60 * Returns a string for the repository, usually this identifies the server
61 * @returns a vcs-implementation-specific string identifying the server
63 QString repositoryServer() const;
64 /**
65 * Returns the module or module path inside the server
66 * @returns a vcs-implementation-specific string identifying the module
68 QString repositoryModule() const;
69 /**
70 * identifies the tag which this location belongs to
71 * @returns a vcs-implementation-specific string identifying the tag
73 QString repositoryTag() const;
74 /**
75 * identifies the branch to which this location belongs to
76 * @returns a vcs-implementation-specific string identifying the branch
78 QString repositoryBranch() const;
79 /**
80 * This can define a path relative to the module, this is used
81 * when identifying a subdirectory or file inside a repository location
82 * @returns a path relative to module
84 QString repositoryPath() const;
85 /**
86 * @returns the type of this location
88 VcsLocation::LocationType type() const;
90 /**
91 * Set the local url for this location, automatically sets the type to LocalLocation
92 * @param url the local url
94 void setLocalUrl( const KUrl& url );
96 /**
97 * Set the server string for this location, automatically sets the type to RepositoryLocation
99 void setRepositoryServer( const QString& );
101 * Set the module for this location, automatically sets the type to RepositoryLocation
103 void setRepositoryModule( const QString& );
105 * Set the branch string for this location, automatically sets the type to RepositoryLocation
107 void setRepositoryBranch( const QString& );
109 * Set the tag string for this location, automatically sets the type to RepositoryLocation
111 void setRepositoryTag( const QString& );
113 * Set the path for this location, automatically sets the type to RepositoryLocation
115 void setRepositoryPath( const QString& );
118 * Allows to add vcs-specific data to this location
119 * automatically sets the type to RepositoryLocation
120 * @param data the vcs-specific data
122 void setUserData( const QVariant& );
125 * retrieve vcs-specific data
127 QVariant userData() const;
129 bool operator==( const KDevelop::VcsLocation& );
131 bool isValid() const;
133 private:
134 class VcsLocationPrivate* d;
137 inline uint qHash( const KDevelop::VcsLocation& loc )
139 if( loc.type() == KDevelop::VcsLocation::LocalLocation )
141 return qHash(loc.localUrl());
142 }else
144 return qHash(loc.repositoryServer());
148 inline bool operator==( const KDevelop::VcsLocation& lhs, const KDevelop::VcsLocation& rhs )
150 return( lhs.type() == rhs.type()
151 && lhs.repositoryServer() == rhs.repositoryServer()
152 && lhs.localUrl() == rhs.localUrl() );
157 Q_DECLARE_METATYPE( KDevelop::VcsLocation )
159 #endif