1 /***************************************************************************
2 * This file is part of KDevelop *
3 * Copyright 2007 Andreas Pakulat <apaku@gmx.de> *
5 * This program is free software; you can redistribute it and/or modify *
6 * it under the terms of the GNU Library General Public License as *
7 * published by the Free Software Foundation; either version 2 of the *
8 * License, or (at your option) any later version. *
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. *
15 * You should have received a copy of the GNU Library General Public *
16 * License along with this program; if not, write to the *
17 * Free Software Foundation, Inc., *
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
19 ***************************************************************************/
23 #include <QtCore/QString>
24 #include <QtCore/QByteArray>
25 #include <QtCore/QHash>
33 QHash
<VcsLocation
,QByteArray
> leftBinaries
;
34 QHash
<VcsLocation
,QByteArray
> rightBinaries
;
35 QHash
<VcsLocation
,QString
> leftTexts
;
36 QHash
<VcsLocation
,QString
> rightTexts
;
39 VcsDiff::Content content
;
43 : d(new VcsDiffPrivate
)
52 VcsDiff::VcsDiff( const VcsDiff
& rhs
)
53 : d(new VcsDiffPrivate
)
55 d
->leftBinaries
= rhs
.d
->leftBinaries
;
56 d
->rightBinaries
= rhs
.d
->rightBinaries
;
57 d
->leftTexts
= rhs
.d
->leftTexts
;
58 d
->rightTexts
= rhs
.d
->rightTexts
;
59 d
->diff
= rhs
.d
->diff
;
60 d
->type
= rhs
.d
->type
;
61 d
->content
= rhs
.d
->content
;
64 VcsDiff::Type
VcsDiff::type() const
69 VcsDiff::Content
VcsDiff::contentType() const
74 QHash
<VcsLocation
, QByteArray
> VcsDiff::leftBinaries() const
76 return d
->leftBinaries
;
79 QHash
<VcsLocation
, QByteArray
> VcsDiff::rightBinaries() const
81 return d
->rightBinaries
;
85 QHash
<VcsLocation
, QString
> VcsDiff::leftTexts() const
90 QHash
<VcsLocation
, QString
> VcsDiff::rightTexts() const
95 QString
VcsDiff::diff() const
101 void VcsDiff::setDiff( const QString
& s
)
106 void VcsDiff::addLeftBinary( const VcsLocation
& loc
, const QByteArray
& b
)
108 d
->leftBinaries
[loc
] = b
;
111 void VcsDiff::addRightBinary( const VcsLocation
& loc
, const QByteArray
& b
)
113 d
->rightBinaries
[loc
] = b
;
116 void VcsDiff::removeLeftBinary( const VcsLocation
& loc
)
118 d
->leftBinaries
.remove( loc
);
121 void VcsDiff::removeRightBinary( const VcsLocation
& loc
)
123 d
->rightBinaries
.remove( loc
);
126 void VcsDiff::addLeftText( const VcsLocation
& loc
, const QString
& b
)
128 d
->leftTexts
[loc
] = b
;
131 void VcsDiff::addRightText( const VcsLocation
& loc
, const QString
& b
)
133 d
->rightTexts
[loc
] = b
;
136 void VcsDiff::removeLeftText( const VcsLocation
& loc
)
138 d
->leftTexts
.remove( loc
);
141 void VcsDiff::removeRightText( const VcsLocation
& loc
)
143 d
->rightTexts
.remove( loc
);
146 void VcsDiff::setType( VcsDiff::Type t
)
151 void VcsDiff::setContentType( VcsDiff::Content c
)
156 VcsDiff
& VcsDiff::operator=( const VcsDiff
& rhs
)
160 d
->content
= rhs
.d
->content
;
161 d
->type
= rhs
.d
->type
;
162 d
->leftBinaries
= rhs
.d
->leftBinaries
;
163 d
->rightBinaries
= rhs
.d
->rightBinaries
;
164 d
->leftTexts
= rhs
.d
->leftTexts
;
165 d
->rightTexts
= rhs
.d
->rightTexts
;
166 d
->diff
= rhs
.d
->diff
;