1 /* 2 SPDX-FileCopyrightText: 2001-2003 Otto Bruggeman <otto.bruggeman@home.nl> 3 SPDX-FileCopyrightText: 2001-2003 John Firebaugh <jfirebaugh@kde.org> 4 5 SPDX-License-Identifier: GPL-2.0-or-later 6 */ 7 8 #ifndef KOMPARE_H 9 #define KOMPARE_H 10 11 #include <QUrl> 12 13 #include "diff2_export.h" 14 15 // Forward declaration needed 16 class QTemporaryDir; 17 18 /** 19 * Kompare namespace 20 */ 21 namespace Kompare 22 { 23 /** 24 * Patch format enum. 25 */ 26 enum Format { 27 Context = 0, 28 Ed = 1, 29 Normal = 2, 30 RCS = 3, 31 Unified = 4, 32 SideBySide = 5, 33 UnknownFormat = -1 34 }; 35 36 /** 37 * Patch generator enum. 38 */ 39 enum Generator { 40 CVSDiff = 0, 41 Diff = 1, 42 Perforce = 2, 43 SubVersion = 3, 44 Reserved2 = 4, 45 Reserved3 = 5, 46 Reserved4 = 6, 47 Reserved5 = 7, 48 Reserved6 = 8, 49 Reserved7 = 9, 50 UnknownGenerator = -1 51 }; 52 53 /** 54 * Mode 55 */ 56 enum Mode { 57 ComparingFiles, // compareFiles 58 ComparingFileString, // Compare a source file with a destination string 59 ComparingStringFile, // Compare a source string with a destination file 60 ComparingDirs, // compareDirs 61 ShowingDiff, // openDiff 62 BlendingDir, // openDirAndDiff 63 BlendingFile, // openFileAndDiff 64 UnknownMode // Used to initialize the Infoi struct 65 }; 66 67 /** 68 * DiffMode 69 */ 70 enum DiffMode { 71 Default, 72 Custom, 73 UnknownDiffMode // Use to initialize the Info struct 74 }; 75 76 /** 77 * State 78 */ 79 enum Status { 80 RunningDiff, 81 Parsing, 82 FinishedParsing, 83 FinishedWritingDiff, 84 ReRunningDiff // When a change has been detected after diff has run 85 }; 86 87 /** 88 * Target 89 */ 90 enum Target { 91 Source, 92 Destination 93 }; 94 95 /** 96 * Info. 97 */ 98 struct DIFF2_EXPORT Info { 99 Info( 100 enum Mode _mode = UnknownMode, 101 enum DiffMode _diffMode = UnknownDiffMode, 102 enum Format _format = UnknownFormat, 103 enum Generator _generator = UnknownGenerator, 104 QUrl _source = QUrl(), 105 QUrl _destination = QUrl(), 106 QString _localSource = QString(), 107 QString _localDestination = QString(), 108 QTemporaryDir* _sourceQTempDir = nullptr, 109 QTemporaryDir* _destinationQTempDir = nullptr, 110 uint _depth = 0, 111 bool _applied = true 112 ); 113 void swapSourceWithDestination(); 114 115 enum Mode mode; 116 enum DiffMode diffMode; 117 enum Format format; 118 enum Generator generator; 119 QUrl source; 120 QUrl destination; 121 QString localSource; 122 QString localDestination; 123 QTemporaryDir* sourceQTempDir; 124 QTemporaryDir* destinationQTempDir; 125 uint depth; 126 bool applied; 127 }; 128 } // End of namespace Kompare 129 130 #endif 131