Changeset View
Changeset View
Standalone View
Standalone View
kdevplatform/services/interfaces/iprojectserviceurlmapper.h
- This file was added.
1 | /* This file is part of KDevelop | ||||
---|---|---|---|---|---|
2 | Copyright 2017 Friedrich W. H. Kossebau <friedrich.w.h@kossebau.de> | ||||
3 | | ||||
4 | This library is free software; you can redistribute it and/or | ||||
5 | modify it under the terms of the GNU Library General Public | ||||
6 | License as published by the Free Software Foundation; either | ||||
7 | version 2 of the License, or (at your option) any later version. | ||||
8 | | ||||
9 | This library is distributed in the hope that it will be useful, | ||||
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||||
12 | Library General Public License for more details. | ||||
13 | | ||||
14 | You should have received a copy of the GNU Library General Public License | ||||
15 | along with this library; see the file COPYING.LIB. If not, write to | ||||
16 | the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||||
17 | Boston, MA 02110-1301, USA. | ||||
18 | */ | ||||
19 | | ||||
20 | #ifndef KDEVPLATFORM_IPROJECTSERVICEURLMAPPER_H | ||||
21 | #define KDEVPLATFORM_IPROJECTSERVICEURLMAPPER_H | ||||
22 | | ||||
23 | #include "servicesexport.h" | ||||
24 | | ||||
25 | #include <QtPlugin> | ||||
26 | #include <QUrl> | ||||
27 | #include <QIcon> | ||||
28 | | ||||
29 | class QUrl; | ||||
30 | | ||||
31 | namespace KTextEditor | ||||
32 | { | ||||
33 | class Cursor; | ||||
34 | } | ||||
35 | | ||||
36 | namespace KDevelop | ||||
37 | { | ||||
38 | class Path; | ||||
39 | class IProject; | ||||
40 | class VcsRevision; | ||||
41 | | ||||
42 | class ProjectServiceUrlData | ||||
43 | { | ||||
44 | public: | ||||
45 | QUrl url; | ||||
46 | QIcon icon; | ||||
47 | QString name; | ||||
48 | }; | ||||
49 | | ||||
50 | /** | ||||
51 | * Provides a mapping between urls to locations/items in services and locations/items in the local project | ||||
52 | */ | ||||
53 | class KDEVPLATFORMSERVICES_EXPORT IProjectServiceUrlMapper | ||||
54 | { | ||||
55 | public: | ||||
56 | virtual ~IProjectServiceUrlMapper(); | ||||
57 | | ||||
58 | // TODO: to/from variants per mapping, perhaps split into separate interfaces? | ||||
59 | enum ProjectServiceUrlMapperCapability { | ||||
60 | TextSelectionProjectUrlMapping = 0x1 << 0, | ||||
61 | VcsRevisionProjectUrlMapping = 0x1 << 1, | ||||
62 | VcsRevisionFileUrlMapping = 0x1 << 2 | ||||
63 | }; | ||||
64 | Q_DECLARE_FLAGS(ProjectServiceUrlMapperCapabilities, ProjectServiceUrlMapperCapability) | ||||
65 | | ||||
66 | virtual ProjectServiceUrlMapperCapabilities projectServiceUrlMapperCapabilities() const = 0; | ||||
67 | | ||||
68 | /** @returns the url of the service matching the document at the project url with the cursor */ | ||||
69 | virtual QVector<ProjectServiceUrlData> projectServiceUrlsFromTextSelection(const QUrl& url, const KTextEditor::Cursor& cursor, IProject* project) const; | ||||
70 | | ||||
71 | // TODO: | ||||
72 | // virtual QUrl urlFromWebServiceUrl(const QUrl& url, IProject* project) const = 0; | ||||
73 | | ||||
74 | virtual QVector<ProjectServiceUrlData> projectServiceUrlsFromVcsRevision(const VcsRevision& revision, | ||||
75 | IProject* project) const; | ||||
76 | | ||||
77 | virtual QVector<ProjectServiceUrlData> projectServiceUrlsFromVcsRevision(const QUrl& url, | ||||
78 | const VcsRevision& revision, | ||||
79 | IProject* project) const; | ||||
80 | }; | ||||
81 | | ||||
82 | Q_DECLARE_OPERATORS_FOR_FLAGS(IProjectServiceUrlMapper::ProjectServiceUrlMapperCapabilities) | ||||
83 | | ||||
84 | } | ||||
85 | | ||||
86 | Q_DECLARE_INTERFACE(KDevelop::IProjectServiceUrlMapper, "org.kdevelop.IProjectServiceUrlMapper") | ||||
87 | | ||||
88 | #endif // KDEVPLATFORM_IPROJECTSERVICEURLMAPPER_H |