File indexing completed on 2024-05-05 05:46:50
0001 /* 0002 SPDX-FileCopyrightText: 2001-2004,2009 Otto Bruggeman <bruggie@gmail.com> 0003 SPDX-FileCopyrightText: 2001-2003 John Firebaugh <jfirebaugh@kde.org> 0004 0005 SPDX-License-Identifier: GPL-2.0-or-later 0006 */ 0007 0008 #ifndef KOMPAREDIFF2_DIFFMODEL_P_H 0009 #define KOMPAREDIFF2_DIFFMODEL_P_H 0010 0011 // lib 0012 #include "diffhunk.h" 0013 #include "diffmodel.h" 0014 0015 namespace KompareDiff2 0016 { 0017 0018 class DiffModelPrivate 0019 { 0020 public: 0021 DiffModelPrivate() = default; 0022 DiffModelPrivate(const QString &source, const QString &destination); 0023 ~DiffModelPrivate(); 0024 0025 public: 0026 DiffModelPrivate &operator=(const DiffModelPrivate &other); 0027 0028 void splitSourceInPathAndFileName(); 0029 void splitDestinationInPathAndFileName(); 0030 0031 static void computeDiffStats(Difference *diff); 0032 static void processStartMarker(Difference *diff, const QStringList &lines, MarkerListConstIterator ¤tMarker, int ¤tListLine, bool isSource); 0033 0034 public: 0035 QString source; 0036 QString destination; 0037 0038 QString sourcePath; 0039 QString destinationPath; 0040 0041 QString sourceFile; 0042 QString destinationFile; 0043 0044 QString sourceTimestamp; 0045 QString destinationTimestamp; 0046 0047 QString sourceRevision; 0048 QString destinationRevision; 0049 0050 DiffHunkList hunks; 0051 DifferenceList differences; 0052 0053 int appliedCount = 0; 0054 0055 int diffIndex = 0; 0056 Difference *selectedDifference = nullptr; 0057 0058 bool blended = false; 0059 }; 0060 0061 inline DiffModelPrivate::DiffModelPrivate(const QString &source, const QString &destination) 0062 : source(source) 0063 , destination(destination) 0064 { 0065 } 0066 0067 inline DiffModelPrivate::~DiffModelPrivate() 0068 { 0069 selectedDifference = nullptr; 0070 0071 qDeleteAll(hunks); 0072 qDeleteAll(differences); 0073 } 0074 0075 inline DiffModelPrivate &DiffModelPrivate::operator=(const DiffModelPrivate &other) 0076 { 0077 source = other.source; 0078 sourcePath = other.sourcePath; 0079 sourceFile = other.sourceFile; 0080 sourceTimestamp = other.sourceTimestamp; 0081 sourceRevision = other.sourceRevision; 0082 0083 destination = other.destination; 0084 destinationPath = other.destinationPath; 0085 destinationFile = other.destinationFile; 0086 destinationTimestamp = other.destinationTimestamp; 0087 destinationRevision = other.destinationRevision; 0088 0089 appliedCount = other.appliedCount; 0090 0091 diffIndex = other.diffIndex; 0092 selectedDifference = other.selectedDifference; 0093 0094 return *this; 0095 } 0096 0097 } 0098 0099 #endif