File indexing completed on 2024-11-24 05:09:40

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 #include "differencestring.h"
0009 #include "differencestring_p.h"
0010 
0011 namespace KompareDiff2
0012 {
0013 
0014 DifferenceString::DifferenceString()
0015     : d_ptr(new DifferenceStringPrivate())
0016 {
0017 //         qCDebug(KOMPAREDIFF2_LOG) << "DifferenceString::DifferenceString()";
0018 }
0019 
0020 DifferenceString::DifferenceString(const QString &string, const MarkerList &markerList)
0021     : d_ptr(new DifferenceStringPrivate(string, markerList))
0022 {
0023 //         qCDebug(KOMPAREDIFF2_LOG) << "DifferenceString::DifferenceString( " << string << ", " << markerList << " )";
0024 }
0025 
0026 DifferenceString::DifferenceString(const DifferenceString &ds)
0027     : d_ptr(new DifferenceStringPrivate(*ds.d_ptr))
0028 {
0029 //         qCDebug(KOMPAREDIFF2_LOG) << "DifferenceString::DifferenceString( const DifferenceString& " << ds << " )";
0030 }
0031 
0032 DifferenceString::~DifferenceString() = default;
0033 
0034 bool DifferenceString::operator==(const DifferenceString &ks) const
0035 {
0036     Q_D(const DifferenceString);
0037 
0038     return (*d == *ks.d_ptr);
0039 }
0040 
0041 QString DifferenceString::string() const
0042 {
0043     Q_D(const DifferenceString);
0044 
0045     return d->string;
0046 }
0047 
0048 QString DifferenceString::conflictString() const
0049 {
0050     Q_D(const DifferenceString);
0051 
0052     return d->conflict;
0053 }
0054 
0055 MarkerList DifferenceString::markerList() const
0056 {
0057     Q_D(const DifferenceString);
0058 
0059     return d->markerList;
0060 }
0061 
0062 void DifferenceString::setString(const QString &string)
0063 {
0064     Q_D(DifferenceString);
0065 
0066     d->string = string;
0067     d->calculateHash();
0068 }
0069 
0070 void DifferenceString::setConflictString(const QString &conflict)
0071 {
0072     Q_D(DifferenceString);
0073 
0074     d->conflict = conflict;
0075 }
0076 
0077 void DifferenceString::setMarkerList(const MarkerList &markerList)
0078 {
0079     Q_D(DifferenceString);
0080 
0081     d->markerList = markerList;
0082 }
0083 
0084 void DifferenceString::prepend(Marker *marker)
0085 {
0086     Q_D(DifferenceString);
0087 
0088     d->markerList.prepend(marker);
0089 }
0090 
0091 }