Changeset View
Changeset View
Standalone View
Standalone View
kdevplatform/vcs/vcsrevisioncontext.cpp
- This file was added.
1 | /* This file is part of KDevelop | ||||
---|---|---|---|---|---|
2 | * | ||||
3 | * Copyright 2017 Friedrich W. H. Kossebau <kossebau@kde.org> | ||||
4 | * | ||||
5 | * This program is free software; you can redistribute it and/or | ||||
6 | * modify it under the terms of the GNU General Public License | ||||
7 | * as published by the Free Software Foundation; either version 2 | ||||
8 | * 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 | ||||
13 | * GNU General Public License for more details. | ||||
14 | * | ||||
15 | * You should have received a copy of the GNU General Public License | ||||
16 | * along with this program; if not, write to the Free Software | ||||
17 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA | ||||
18 | * 02110-1301, USA. | ||||
19 | */ | ||||
20 | | ||||
21 | #include "vcsrevisioncontext.h" | ||||
22 | | ||||
23 | #include "vcsrevision.h" | ||||
24 | | ||||
25 | using namespace KDevelop; | ||||
26 | | ||||
27 | class KDevelop::VcsRevisionContextPrivate | ||||
28 | { | ||||
29 | public: | ||||
30 | VcsRevisionContextPrivate(IProject* project, const VcsRevision& revision, const QUrl& url) | ||||
31 | : project(project) | ||||
32 | , revision(revision) | ||||
33 | , url(url) | ||||
34 | {} | ||||
35 | | ||||
36 | IProject* const project; | ||||
37 | const VcsRevision revision; | ||||
38 | const QUrl url; | ||||
39 | }; | ||||
40 | | ||||
41 | VcsRevisionContext::VcsRevisionContext(IProject* project, const VcsRevision& revision, const QUrl& url) | ||||
42 | : Context() | ||||
43 | , d(new VcsRevisionContextPrivate(project, revision, url)) | ||||
44 | { | ||||
45 | } | ||||
46 | | ||||
47 | VcsRevisionContext::~VcsRevisionContext() = default; | ||||
48 | | ||||
49 | int VcsRevisionContext::type() const | ||||
50 | { | ||||
51 | return Context::VcsRevisionContext; | ||||
52 | } | ||||
53 | | ||||
54 | QList<QUrl> VcsRevisionContext::urls() const | ||||
55 | { | ||||
56 | if (d->url.isValid()) { | ||||
57 | return { d->url }; | ||||
58 | } | ||||
59 | | ||||
60 | return {}; | ||||
61 | } | ||||
62 | | ||||
63 | IProject* KDevelop::VcsRevisionContext::project() const | ||||
64 | { | ||||
65 | return d->project; | ||||
66 | } | ||||
67 | | ||||
68 | VcsRevision VcsRevisionContext::revision() const | ||||
69 | { | ||||
70 | return d->revision; | ||||
71 | } |