File indexing completed on 2024-04-28 17:01:40

0001 /*
0002 SPDX-FileCopyrightText: 2001-2003 Otto Bruggeman <otto.bruggeman@home.nl>
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_KOMPARE_H
0009 #define KOMPAREDIFF2_KOMPARE_H
0010 
0011 #include <QUrl>
0012 
0013 #include "komparediff2_export.h"
0014 
0015 // Forward declaration needed
0016 class QTemporaryDir;
0017 
0018 /**
0019  * Kompare namespace
0020  */
0021 namespace Kompare
0022 {
0023 /**
0024  * Patch format enum.
0025  */
0026 enum Format {
0027     Context       = 0,
0028     Ed            = 1,
0029     Normal        = 2,
0030     RCS           = 3,
0031     Unified       = 4,
0032     SideBySide    = 5,
0033     UnknownFormat = -1
0034 };
0035 
0036 /**
0037  * Patch generator enum.
0038  */
0039 enum Generator {
0040     CVSDiff          = 0,
0041     Diff             = 1,
0042     Perforce         = 2,
0043     SubVersion       = 3,
0044     Reserved2        = 4,
0045     Reserved3        = 5,
0046     Reserved4        = 6,
0047     Reserved5        = 7,
0048     Reserved6        = 8,
0049     Reserved7        = 9,
0050     UnknownGenerator = -1
0051 };
0052 
0053 /**
0054  * Mode
0055  */
0056 enum Mode {
0057     ComparingFiles,      // compareFiles
0058     ComparingFileString, // Compare a source file with a destination string
0059     ComparingStringFile, // Compare a source string with a destination file
0060     ComparingDirs,       // compareDirs
0061     ShowingDiff,         // openDiff
0062     BlendingDir,         // openDirAndDiff
0063     BlendingFile,        // openFileAndDiff
0064     UnknownMode          // Used to initialize the Infoi struct
0065 };
0066 
0067 /**
0068  * DiffMode
0069  */
0070 enum DiffMode {
0071     Default,
0072     Custom,
0073     UnknownDiffMode // Use to initialize the Info struct
0074 };
0075 
0076 /**
0077  * State
0078  */
0079 enum Status {
0080     RunningDiff,
0081     Parsing,
0082     FinishedParsing,
0083     FinishedWritingDiff,
0084     ReRunningDiff   // When a change has been detected after diff has run
0085 };
0086 
0087 /**
0088  * Target
0089  */
0090 enum Target {
0091     Source,
0092     Destination
0093 };
0094 
0095 /**
0096  * @class Info kompare.h <KompareDiff2/Kompare>
0097  *
0098  * Info.
0099  */
0100 struct KOMPAREDIFF2_EXPORT Info {
0101     Info(
0102         enum Mode _mode = UnknownMode,
0103         enum DiffMode _diffMode = UnknownDiffMode,
0104         enum Format _format = UnknownFormat,
0105         enum Generator _generator = UnknownGenerator,
0106         QUrl _source = QUrl(),
0107         QUrl _destination = QUrl(),
0108         QString _localSource = QString(),
0109         QString _localDestination = QString(),
0110         QTemporaryDir* _sourceQTempDir = nullptr,
0111         QTemporaryDir* _destinationQTempDir = nullptr,
0112         uint _depth = 0,
0113         bool _applied = true
0114     );
0115     void swapSourceWithDestination();
0116 
0117     enum Mode      mode;
0118     enum DiffMode  diffMode;
0119     enum Format    format;
0120     enum Generator generator;
0121     QUrl           source;
0122     QUrl           destination;
0123     QString        localSource;
0124     QString        localDestination;
0125     QTemporaryDir*      sourceQTempDir;
0126     QTemporaryDir*      destinationQTempDir;
0127     uint           depth;
0128     bool           applied;
0129 };
0130 } // End of namespace Kompare
0131 
0132 #endif