1 /* This file is part of KDevelop
3 * Copyright 2007 Andreas Pakulat <apaku@gmx.de>
4 * Copyright 2007 Matthew Woehlke <mw_triad@users.sourceforge.net>
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version 2
9 * of the License, or (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
25 //Needed first as it provides a hash-function for QHash
26 #include "vcslocation.h"
28 #include <QtCore/QHash>
30 #include "vcsexport.h"
38 class KDEVPLATFORMVCS_EXPORT VcsDiff
42 * Specify the type of difference the diff() method should create. Note that a
43 * request for DiffUnified may not be honored, e.g. if the items being diffed are
44 * binary rather than text.
48 DiffRaw
/**< Request complete copies of both items. */,
49 DiffUnified
/**< Request copy of first item with diff. */,
50 DiffDontCare
/**< Don't care; plugin will return whichever is easiest. */
55 Binary
/**< Binary diff, using the full content of both files.*/,
56 Text
/**< Textual diff.*/
61 VcsDiff( const VcsDiff
& );
64 * @returns the type of diff, i.e. raw or unified
69 * @returns the content type, i.e. binary or text
71 Content
contentType() const;
74 * @returns the binary content of the first file of the difference or
75 * an empty QByteArray if this is a textual diff
77 QHash
<KDevelop::VcsLocation
, QByteArray
> leftBinaries() const;
80 * @returns the binary content of the second file of the difference or
81 * an empty QByteArray if this is a textual diff
83 QHash
<KDevelop::VcsLocation
, QByteArray
> rightBinaries() const;
86 * @returns the textual content of the first file of the difference or
87 * an empty QString if this is a binary diff
89 QHash
<KDevelop::VcsLocation
, QString
> leftTexts() const;
92 * @returns the textual content of the second file of the difference or
93 * an empty QString if this is a unified or binary diff
95 QHash
<KDevelop::VcsLocation
, QString
> rightTexts() const;
98 * @returns the difference between the first and the second file in
99 * unified diff format or an empty QString if this is a binary diff
100 * or a textual diff using raw format
102 QString
diff() const;
104 void setDiff( const QString
& );
105 void addLeftBinary( const KDevelop::VcsLocation
&, const QByteArray
& );
106 void removeLeftBinary( const KDevelop::VcsLocation
& );
107 void addRightBinary( const KDevelop::VcsLocation
&, const QByteArray
& );
108 void removeRightBinary( const KDevelop::VcsLocation
& );
110 void addLeftText( const KDevelop::VcsLocation
&, const QString
& );
111 void removeLeftText( const KDevelop::VcsLocation
& );
112 void addRightText( const KDevelop::VcsLocation
&, const QString
& );
113 void removeRightText( const KDevelop::VcsLocation
& );
115 void setType( Type
);
116 void setContentType( Content
);
117 VcsDiff
& operator=( const VcsDiff
& rhs
);
119 class VcsDiffPrivate
* const d
;
124 Q_DECLARE_METATYPE( KDevelop::VcsDiff
)