vcs
vcsdiff.cpp
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #include "vcsdiff.h"
00022
00023 #include <QtCore/QString>
00024 #include <QtCore/QByteArray>
00025 #include <QtCore/QHash>
00026
00027 namespace KDevelop
00028 {
00029
00030 class VcsDiffPrivate
00031 {
00032 public:
00033 QHash<VcsLocation,QByteArray> leftBinaries;
00034 QHash<VcsLocation,QByteArray> rightBinaries;
00035 QHash<VcsLocation,QString> leftTexts;
00036 QHash<VcsLocation,QString> rightTexts;
00037 QString diff;
00038 VcsDiff::Type type;
00039 VcsDiff::Content content;
00040 };
00041
00042 VcsDiff::VcsDiff()
00043 : d(new VcsDiffPrivate)
00044 {
00045 }
00046
00047 VcsDiff::~VcsDiff()
00048 {
00049 delete d;
00050 }
00051
00052 VcsDiff::VcsDiff( const VcsDiff& rhs )
00053 : d(new VcsDiffPrivate)
00054 {
00055 d->leftBinaries = rhs.d->leftBinaries;
00056 d->rightBinaries = rhs.d->rightBinaries;
00057 d->leftTexts = rhs.d->leftTexts;
00058 d->rightTexts = rhs.d->rightTexts;
00059 d->diff = rhs.d->diff;
00060 d->type = rhs.d->type;
00061 d->content = rhs.d->content;
00062 }
00063
00064 VcsDiff::Type VcsDiff::type() const
00065 {
00066 return d->type;
00067 }
00068
00069 VcsDiff::Content VcsDiff::contentType() const
00070 {
00071 return d->content;
00072 }
00073
00074 QHash<VcsLocation, QByteArray> VcsDiff::leftBinaries() const
00075 {
00076 return d->leftBinaries;
00077 }
00078
00079 QHash<VcsLocation, QByteArray> VcsDiff::rightBinaries() const
00080 {
00081 return d->rightBinaries;
00082 }
00083
00084
00085 QHash<VcsLocation, QString> VcsDiff::leftTexts() const
00086 {
00087 return d->leftTexts;
00088 }
00089
00090 QHash<VcsLocation, QString> VcsDiff::rightTexts() const
00091 {
00092 return d->rightTexts;
00093 }
00094
00095 QString VcsDiff::diff() const
00096 {
00097 return d->diff;
00098 }
00099
00100
00101 void VcsDiff::setDiff( const QString& s )
00102 {
00103 d->diff = s;
00104 }
00105
00106 void VcsDiff::addLeftBinary( const VcsLocation& loc, const QByteArray& b )
00107 {
00108 d->leftBinaries[loc] = b;
00109 }
00110
00111 void VcsDiff::addRightBinary( const VcsLocation& loc, const QByteArray& b )
00112 {
00113 d->rightBinaries[loc] = b;
00114 }
00115
00116 void VcsDiff::removeLeftBinary( const VcsLocation& loc )
00117 {
00118 d->leftBinaries.remove( loc );
00119 }
00120
00121 void VcsDiff::removeRightBinary( const VcsLocation& loc )
00122 {
00123 d->rightBinaries.remove( loc );
00124 }
00125
00126 void VcsDiff::addLeftText( const VcsLocation& loc, const QString& b )
00127 {
00128 d->leftTexts[loc] = b;
00129 }
00130
00131 void VcsDiff::addRightText( const VcsLocation& loc, const QString& b )
00132 {
00133 d->rightTexts[loc] = b;
00134 }
00135
00136 void VcsDiff::removeLeftText( const VcsLocation& loc )
00137 {
00138 d->leftTexts.remove( loc );
00139 }
00140
00141 void VcsDiff::removeRightText( const VcsLocation& loc )
00142 {
00143 d->rightTexts.remove( loc );
00144 }
00145
00146 void VcsDiff::setType( VcsDiff::Type t )
00147 {
00148 d->type = t;
00149 }
00150
00151 void VcsDiff::setContentType( VcsDiff::Content c )
00152 {
00153 d->content = c;
00154 }
00155
00156 VcsDiff& VcsDiff::operator=( const VcsDiff& rhs)
00157 {
00158 if(this == &rhs)
00159 return *this;
00160 d->content = rhs.d->content;
00161 d->type = rhs.d->type;
00162 d->leftBinaries = rhs.d->leftBinaries;
00163 d->rightBinaries = rhs.d->rightBinaries;
00164 d->leftTexts = rhs.d->leftTexts;
00165 d->rightTexts = rhs.d->rightTexts;
00166 d->diff = rhs.d->diff;
00167 return *this;
00168 }
00169
00170 }
00171