• Skip to content
  • Skip to link menu
KDE 4.2 API Reference
  • KDE API Reference
  • kdesdk
  • Sitemap
  • Contact Us
 

kompare

diffmodel.h

Go to the documentation of this file.
00001 /***************************************************************************
00002                                 diffmodel.h
00003                                 -----------
00004         begin                   : Sun Mar 4 2001
00005         Copyright 2001-2004 Otto Bruggeman <otto.bruggeman@home.nl>
00006         Copyright 2001-2003 John Firebaugh <jfirebaugh@kde.org>                                 
00007 ****************************************************************************/
00008 
00009 /***************************************************************************
00010 **
00011 **   This program is free software; you can redistribute it and/or modify
00012 **   it under the terms of the GNU General Public License as published by
00013 **   the Free Software Foundation; either version 2 of the License, or
00014 **   (at your option) any later version.
00015 **
00016 ***************************************************************************/
00017 
00018 #ifndef DIFFMODEL_H
00019 #define DIFFMODEL_H
00020 
00021 #include <QtCore/QObject>
00022 #include <QtCore/QStringList>
00023 
00024 #include "diffhunk.h"
00025 #include "kompare.h"
00026 #include "diff2export.h"
00027 
00028 namespace Diff2
00029 {
00030 
00031 class DiffHunk;
00032 class Difference;
00033 
00034 class DIFF2_EXPORT DiffModel : public QObject
00035 {
00036 Q_OBJECT
00037 public:
00038 
00039     DiffModel( const QString& srcBaseURL, const QString& destBaseURL );
00040     DiffModel();
00041     DiffModel( const DiffModel& ) : QObject() {};
00042     ~DiffModel();
00043 
00044     int parseDiff( enum Kompare::Format format, const QStringList& list );
00045 
00046     QString recreateDiff() const;
00047 
00048     int hunkCount() const       { return m_hunks.count(); }
00049     int differenceCount() const { return m_differences.count(); }
00050     int appliedCount() const    { return m_appliedCount; }
00051 
00052     DiffHunk* hunkAt( int i )               { return *( m_hunks.at( i ) ); }
00053     const Difference* differenceAt( int i ) { return *( m_differences.at( i ) ); }
00054 
00055     DiffHunkList*         hunks()             { return &m_hunks; }
00056     const DiffHunkList*   hunks() const       { return &m_hunks; }
00057     DifferenceList*       differences()       { return &m_differences; }
00058     const DifferenceList* differences() const { return &m_differences; }
00059 
00060     DifferenceList*       allDifferences();
00061 
00062     int findDifference( Difference* diff ) const { return m_differences.findIndex( diff ); }
00063 
00064     Difference* firstDifference();
00065     Difference* lastDifference();
00066     Difference* prevDifference();
00067     Difference* nextDifference();
00068 
00069     const QString source() const               { return m_source; }
00070     const QString destination() const          { return m_destination; }
00071     const QString sourceFile() const;
00072     const QString destinationFile() const;
00073     const QString sourcePath() const;
00074     const QString destinationPath() const;
00075     const QString sourceTimestamp() const      { return m_sourceTimestamp; }
00076     const QString destinationTimestamp() const { return m_destinationTimestamp; }
00077     const QString sourceRevision() const       { return m_sourceRevision; }
00078     const QString destinationRevision() const  { return m_destinationRevision; }
00079 
00080     void setSourceFile( QString path );
00081     void setDestinationFile( QString path );
00082     void setSourceTimestamp( QString timestamp );
00083     void setDestinationTimestamp( QString timestamp );
00084     void setSourceRevision( QString revision );
00085     void setDestinationRevision( QString revision );
00086 
00087     void addHunk( DiffHunk* hunk );
00088     void addDiff( Difference* diff );
00089     bool isModified() const { return m_modified; }
00090 
00091     const int diffIndex( void ) const       { return m_diffIndex; }
00092     void      setDiffIndex( int diffIndex ) { m_diffIndex = diffIndex; }
00093 
00094     void applyDifference( bool apply );
00095     void applyAllDifferences( bool apply );
00096 
00097     bool setSelectedDifference( Difference* diff );
00098 
00099     DiffModel& operator=( const DiffModel& model );
00100     bool operator<( const DiffModel& model );
00101 
00102     int localeAwareCompareSource( const DiffModel& model );
00103 
00104     bool isBlended() const { return m_blended; }
00105     void setBlended( bool blended ) { m_blended = blended; }
00106 
00107 signals:
00108     void setModified( bool modified );
00109 
00110 public slots:
00111     void slotSetModified( bool modified );
00112 
00113 private:
00114     void splitSourceInPathAndFileName();
00115     void splitDestinationInPathAndFileName();
00116 
00117 private:
00118     QString m_source;
00119     QString m_destination;
00120 
00121     QString m_sourcePath;
00122     QString m_destinationPath;
00123 
00124     QString m_sourceFile;
00125     QString m_destinationFile;
00126 
00127     QString m_sourceTimestamp;
00128     QString m_destinationTimestamp;
00129 
00130     QString m_sourceRevision;
00131     QString m_destinationRevision;
00132 
00133     DiffHunkList   m_hunks;
00134     DifferenceList m_differences;
00135     DifferenceList m_allDifferences;
00136 
00137     int  m_appliedCount;
00138     bool m_modified;
00139 
00140     int          m_diffIndex;
00141     Difference*  m_selectedDifference;
00142 
00143     bool m_blended;
00144 };
00145 
00146 } // End of namespace Diff2
00147 
00148 #endif
00149 

kompare

Skip menu "kompare"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members

kdesdk

Skip menu "kdesdk"
  • kapptemplate
  • kate
  •     kate
  • kbugbuster
  • kcachegrind
  • kompare
  • lokalize
  • umbrello
  •   umbrello
Generated for kdesdk by doxygen 1.5.7
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