Changeset View
Changeset View
Standalone View
Standalone View
kdevplatform/vcs/vcsdiff.cpp
Show All 16 Lines | |||||
17 | * Free Software Foundation, Inc., * | 17 | * Free Software Foundation, Inc., * | ||
18 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * | 18 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * | ||
19 | ***************************************************************************/ | 19 | ***************************************************************************/ | ||
20 | 20 | | |||
21 | #include "vcsdiff.h" | 21 | #include "vcsdiff.h" | ||
22 | 22 | | |||
23 | #include <QString> | 23 | #include <QString> | ||
24 | #include <QByteArray> | 24 | #include <QByteArray> | ||
25 | #include <QHash> | 25 | #include <QSharedData> | ||
26 | 26 | | |||
27 | namespace KDevelop | 27 | namespace KDevelop | ||
28 | { | 28 | { | ||
29 | 29 | | |||
30 | class VcsDiffPrivate | 30 | class VcsDiffPrivate : public QSharedData | ||
31 | { | 31 | { | ||
32 | public: | 32 | public: | ||
33 | QHash<VcsLocation,QByteArray> leftBinaries; | 33 | QHash<VcsLocation,QByteArray> leftBinaries; | ||
34 | QHash<VcsLocation,QByteArray> rightBinaries; | 34 | QHash<VcsLocation,QByteArray> rightBinaries; | ||
35 | QHash<VcsLocation,QString> leftTexts; | 35 | QHash<VcsLocation,QString> leftTexts; | ||
36 | QHash<VcsLocation,QString> rightTexts; | 36 | QHash<VcsLocation,QString> rightTexts; | ||
37 | QUrl baseDiff; | 37 | QUrl baseDiff; | ||
38 | QString diff; | 38 | QString diff; | ||
39 | VcsDiff::Type type = VcsDiff::DiffDontCare; | 39 | VcsDiff::Type type = VcsDiff::DiffDontCare; | ||
40 | VcsDiff::Content content = VcsDiff::Text; | 40 | VcsDiff::Content content = VcsDiff::Text; | ||
41 | uint depth = 0; | 41 | uint depth = 0; | ||
42 | }; | 42 | }; | ||
43 | 43 | | |||
44 | VcsDiff::VcsDiff() | 44 | VcsDiff::VcsDiff() | ||
45 | : d(new VcsDiffPrivate) | 45 | : d(new VcsDiffPrivate) | ||
46 | { | 46 | { | ||
47 | } | 47 | } | ||
48 | 48 | | |||
49 | VcsDiff::~VcsDiff() = default; | 49 | VcsDiff::~VcsDiff() = default; | ||
50 | 50 | | |||
51 | VcsDiff::VcsDiff( const VcsDiff& rhs ) | 51 | VcsDiff::VcsDiff( const VcsDiff& rhs ) | ||
52 | : d(new VcsDiffPrivate) | 52 | : d(rhs.d) | ||
53 | { | 53 | { | ||
54 | *d = *rhs.d; | | |||
55 | } | 54 | } | ||
56 | 55 | | |||
57 | bool VcsDiff::isEmpty() const | 56 | bool VcsDiff::isEmpty() const | ||
58 | { | 57 | { | ||
59 | return d->diff.isEmpty() && d->leftBinaries.isEmpty() && d->rightBinaries.isEmpty() | 58 | return d->diff.isEmpty() && d->leftBinaries.isEmpty() && d->rightBinaries.isEmpty() | ||
60 | && d->leftTexts.isEmpty() && d->rightTexts.isEmpty(); | 59 | && d->leftTexts.isEmpty() && d->rightTexts.isEmpty(); | ||
61 | } | 60 | } | ||
62 | 61 | | |||
▲ Show 20 Lines • Show All 86 Lines • ▼ Show 20 Line(s) | |||||
149 | 148 | | |||
150 | void VcsDiff::setContentType( VcsDiff::Content c ) | 149 | void VcsDiff::setContentType( VcsDiff::Content c ) | ||
151 | { | 150 | { | ||
152 | d->content = c; | 151 | d->content = c; | ||
153 | } | 152 | } | ||
154 | 153 | | |||
155 | VcsDiff& VcsDiff::operator=( const VcsDiff& rhs) | 154 | VcsDiff& VcsDiff::operator=( const VcsDiff& rhs) | ||
156 | { | 155 | { | ||
157 | if (this != &rhs) { | 156 | d = rhs.d; | ||
158 | *d = *rhs.d; | | |||
159 | } | | |||
160 | return *this; | 157 | return *this; | ||
161 | } | 158 | } | ||
162 | 159 | | |||
163 | QUrl VcsDiff::baseDiff() const | 160 | QUrl VcsDiff::baseDiff() const | ||
164 | { | 161 | { | ||
165 | return d->baseDiff; | 162 | return d->baseDiff; | ||
166 | } | 163 | } | ||
167 | 164 | | |||
Show All 18 Lines |