Add line for debugging
[kdevelopdvcssupport.git] / vcs / vcsdiff.cpp
blob136ada43292950130158255ff1afdadbb3f27e06
1 /***************************************************************************
2 * This file is part of KDevelop *
3 * Copyright 2007 Andreas Pakulat <apaku@gmx.de> *
4 * *
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. *
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 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 ***************************************************************************/
21 #include "vcsdiff.h"
23 #include <QtCore/QString>
24 #include <QtCore/QByteArray>
25 #include <QtCore/QHash>
27 namespace KDevelop
30 class VcsDiffPrivate
32 public:
33 QHash<VcsLocation,QByteArray> leftBinaries;
34 QHash<VcsLocation,QByteArray> rightBinaries;
35 QHash<VcsLocation,QString> leftTexts;
36 QHash<VcsLocation,QString> rightTexts;
37 QString diff;
38 VcsDiff::Type type;
39 VcsDiff::Content content;
42 VcsDiff::VcsDiff()
43 : d(new VcsDiffPrivate)
47 VcsDiff::~VcsDiff()
49 delete d;
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
66 return d->type;
69 VcsDiff::Content VcsDiff::contentType() const
71 return d->content;
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
87 return d->leftTexts;
90 QHash<VcsLocation, QString> VcsDiff::rightTexts() const
92 return d->rightTexts;
95 QString VcsDiff::diff() const
97 return d->diff;
101 void VcsDiff::setDiff( const QString& s )
103 d->diff = 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 )
148 d->type = t;
151 void VcsDiff::setContentType( VcsDiff::Content c )
153 d->content = c;
156 VcsDiff& VcsDiff::operator=( const VcsDiff& rhs)
158 if(this == &rhs)
159 return *this;
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;
167 return *this;