• Skip to content
  • Skip to link menu
KDE 4.2 API Reference
  • KDE API Reference
  • KDevelop Platform Libraries
  • Sitemap
  • Contact Us
 

vcs

vcsdiff.cpp

00001 /***************************************************************************
00002  *   This file is part of KDevelop                                         *
00003  *   Copyright 2007 Andreas Pakulat <apaku@gmx.de>                     *
00004  *                                                                         *
00005  *   This program is free software; you can redistribute it and/or modify  *
00006  *   it under the terms of the GNU Library General Public License as       *
00007  *   published by the Free Software Foundation; either version 2 of the    *
00008  *   License, or (at your option) any later version.                       *
00009  *                                                                         *
00010  *   This program is distributed in the hope that it will be useful,       *
00011  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00012  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
00013  *   GNU General Public License for more details.                          *
00014  *                                                                         *
00015  *   You should have received a copy of the GNU Library General Public     *
00016  *   License along with this program; if not, write to the                 *
00017  *   Free Software Foundation, Inc.,                                       *
00018  *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.         *
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 

vcs

Skip menu "vcs"
  • Main Page
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Class Members
  • Related Pages

KDevelop Platform Libraries

Skip menu "KDevelop Platform Libraries"
  • interfaces
  • language
  •   codegen
  •   duchain
  •   editor
  • outputview
  •     interfaces
  • project
  • shell
  • sublime
  • util
  • vcs
Generated for KDevelop Platform Libraries by doxygen 1.5.4
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal