summaryrefslogtreecommitdiffstats
path: root/kompare/libdiff2/kompare.h
diff options
context:
space:
mode:
authortoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
committertoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
commitbd9e6617827818fd043452c08c606f07b78014a0 (patch)
tree425bb4c3168f9c02f10150f235d2cb998dcc6108 /kompare/libdiff2/kompare.h
downloadtdesdk-bd9e6617827818fd043452c08c606f07b78014a0.tar.gz
tdesdk-bd9e6617827818fd043452c08c606f07b78014a0.zip
Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features.
BUG:215923 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdesdk@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kompare/libdiff2/kompare.h')
-rw-r--r--kompare/libdiff2/kompare.h144
1 files changed, 144 insertions, 0 deletions
diff --git a/kompare/libdiff2/kompare.h b/kompare/libdiff2/kompare.h
new file mode 100644
index 00000000..1ed5c4c7
--- /dev/null
+++ b/kompare/libdiff2/kompare.h
@@ -0,0 +1,144 @@
+/***************************************************************************
+ kompare.h - description
+ -------------------
+ begin : Sun Mar 4 2001
+ copyright : (C) 2001-2003 by Otto Bruggeman
+ and John Firebaugh
+ email : otto.bruggeman@home.nl
+ jfirebaugh@kde.org
+****************************************************************************/
+
+/***************************************************************************
+**
+** This program is free software; you can redistribute it and/or modify
+** it under the terms of the GNU General Public License as published by
+** the Free Software Foundation; either version 2 of the License, or
+** (at your option) any later version.
+**
+***************************************************************************/
+
+#ifndef KOMPARE_H
+#define KOMPARE_H
+
+#include <kurl.h>
+
+namespace Kompare
+{
+ enum Format {
+ Context = 0,
+ Ed = 1,
+ Normal = 2,
+ RCS = 3,
+ Unified = 4,
+ SideBySide = 5,
+ UnknownFormat = -1
+ };
+
+ enum Generator {
+ CVSDiff = 0,
+ Diff = 1,
+ Perforce = 2,
+ SubVersion = 3,
+ Reserved2 = 4,
+ Reserved3 = 5,
+ Reserved4 = 6,
+ Reserved5 = 7,
+ Reserved6 = 8,
+ Reserved7 = 9,
+ UnknownGenerator = -1
+ };
+
+ enum Mode {
+ ComparingFiles, // compareFiles
+ ComparingDirs, // compareDirs
+ ShowingDiff, // openDiff
+ BlendingDir, // openDirAnfDiff
+ BlendingFile, // openFileAndDiff
+ UnknownMode // Used to initialize the Infoi struct
+ };
+
+ enum DiffMode {
+ Default,
+ Custom,
+ UnknownDiffMode // Use to initialize the Info struct
+ };
+
+ enum Status {
+ RunningDiff,
+ Parsing,
+ FinishedParsing,
+ FinishedWritingDiff,
+ ReRunningDiff // When a change has been detected after diff has run
+ };
+
+ enum Target {
+ Source,
+ Destination
+ };
+
+ struct Info {
+ Info (
+ enum Mode _mode = UnknownMode,
+ enum DiffMode _diffMode = UnknownDiffMode,
+ enum Format _format = UnknownFormat,
+ enum Generator _generator = UnknownGenerator,
+ KURL _source = KURL(),
+ KURL _destination = KURL(),
+ QString _localSource = "",
+ QString _localDestination = ""
+ )
+ {
+ mode = _mode;
+ diffMode = _diffMode;
+ format = _format;
+ generator = _generator;
+ source = _source;
+ destination = _destination;
+ localSource = _localSource;
+ localDestination = _localDestination;
+ }
+ enum Mode mode;
+ enum DiffMode diffMode;
+ enum Format format;
+ enum Generator generator;
+ KURL source;
+ KURL destination;
+ QString localSource;
+ QString localDestination;
+ };
+} // End of namespace Kompare
+
+/*
+** This should be removed and put somewhere else
+*/
+class KompareFunctions
+{
+public:
+ static QString constructRelativePath( const QString& from, const QString& to )
+ {
+ KURL fromURL( from );
+ KURL toURL( to );
+ KURL root;
+ int upLevels = 0;
+
+ // Find a common root.
+ root = from;
+ while( root.isValid() && !root.isParentOf( toURL ) ) {
+ root = root.upURL();
+ upLevels++;
+ }
+
+ if( !root.isValid() ) return to;
+
+ QString relative;
+ for( ; upLevels > 0; upLevels-- ) {
+ relative += "../";
+ }
+
+ relative += QString( to ).replace( 0, root.path(1).length(), "" );
+
+ return relative;
+ }
+};
+
+#endif