Fix no newlines warnings. Patch by Peter Oberndorfer
[kdevelopdvcssupport.git] / vcs / vcsdiff.h
blob1bfd677e2e2b636c61f4248ab97c550132762c3d
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
19 * 02110-1301, USA.
22 #ifndef VCSDIFF_H
23 #define VCSDIFF_H
25 //Needed first as it provides a hash-function for QHash
26 #include "vcslocation.h"
28 #include <QtCore/QHash>
30 #include "vcsexport.h"
32 class QString;
33 class QByteArray;
35 namespace KDevelop
38 class KDEVPLATFORMVCS_EXPORT VcsDiff
40 public:
41 /**
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.
46 enum Type
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. */
53 enum Content
55 Binary /**< Binary diff, using the full content of both files.*/,
56 Text /**< Textual diff.*/
59 VcsDiff();
60 virtual ~VcsDiff();
61 VcsDiff( const VcsDiff& );
63 /**
64 * @returns the type of diff, i.e. raw or unified
66 Type type() const;
68 /**
69 * @returns the content type, i.e. binary or text
71 Content contentType() const;
73 /**
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;
79 /**
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;
85 /**
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;
91 /**
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;
97 /**
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);
118 private:
119 class VcsDiffPrivate* const d;
124 Q_DECLARE_METATYPE( KDevelop::VcsDiff )
126 #endif