You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
139 lines
3.5 KiB
139 lines
3.5 KiB
15 years ago
|
/*
|
||
13 years ago
|
This file is part of libtdepim.
|
||
15 years ago
|
|
||
|
Copyright (c) 2004 Tobias Koenig <tokoe@kde.org>
|
||
|
|
||
|
This library is free software; you can redistribute it and/or
|
||
|
modify it under the terms of the GNU Library General Public
|
||
|
License as published by the Free Software Foundation; either
|
||
|
version 2 of the License, or (at your option) any later version.
|
||
|
|
||
|
This library is distributed in the hope that it will be useful,
|
||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||
|
Library General Public License for more details.
|
||
|
|
||
|
You should have received a copy of the GNU Library General Public License
|
||
|
along with this library; see the file COPYING.LIB. If not, write to
|
||
|
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||
|
Boston, MA 02110-1301, USA.
|
||
|
*/
|
||
|
|
||
|
#ifndef DIFFALGO_H
|
||
|
#define DIFFALGO_H
|
||
|
|
||
14 years ago
|
#include <tqvaluelist.h>
|
||
13 years ago
|
#include <tdepimmacros.h>
|
||
15 years ago
|
|
||
|
namespace KPIM {
|
||
|
|
||
|
/**
|
||
|
DiffAlgo and DiffAlgoDisplay work together for displaying differences between
|
||
|
two PIM objects like contacts, events or todos.
|
||
|
DiffAlgo is the bas class for the diffing algorithm and DiffAlgoDisplay is
|
||
|
responsible for representation. The separation makes it possible to use one
|
||
|
display for all diffing algorithm and vice versa.
|
||
|
*/
|
||
|
class DiffAlgoDisplay
|
||
|
{
|
||
|
public:
|
||
|
|
||
|
/**
|
||
|
Is called on the start of the diff.
|
||
|
*/
|
||
|
virtual void begin() = 0;
|
||
|
|
||
|
/**
|
||
|
Is called on the end of the diff.
|
||
|
*/
|
||
|
virtual void end() = 0;
|
||
|
|
||
|
/**
|
||
|
Sets the title of the left data source.
|
||
|
*/
|
||
14 years ago
|
virtual void setLeftSourceTitle( const TQString &title ) = 0;
|
||
15 years ago
|
|
||
|
/**
|
||
|
Sets the title of the right data source.
|
||
|
*/
|
||
14 years ago
|
virtual void setRightSourceTitle( const TQString &title ) = 0;
|
||
15 years ago
|
|
||
|
/**
|
||
|
Adds a field which is only available in the left data source.
|
||
|
*/
|
||
14 years ago
|
virtual void additionalLeftField( const TQString &id, const TQString &value ) = 0;
|
||
15 years ago
|
|
||
|
/**
|
||
|
Adds a field which is only available in the right data source.
|
||
|
*/
|
||
14 years ago
|
virtual void additionalRightField( const TQString &id, const TQString &value ) = 0;
|
||
15 years ago
|
|
||
|
/**
|
||
|
Adds a conflict between two fields.
|
||
|
*/
|
||
14 years ago
|
virtual void conflictField( const TQString &id, const TQString &leftValue,
|
||
|
const TQString &rightValue ) = 0;
|
||
15 years ago
|
};
|
||
|
|
||
|
|
||
|
class KDE_EXPORT DiffAlgo
|
||
|
{
|
||
|
public:
|
||
|
/**
|
||
|
Destructor.
|
||
|
*/
|
||
|
virtual ~DiffAlgo() {}
|
||
|
|
||
|
/**
|
||
|
Starts the diffing algorithm.
|
||
|
*/
|
||
|
virtual void run() = 0;
|
||
|
|
||
|
/**
|
||
|
Must be called on the start of the diff.
|
||
|
*/
|
||
|
void begin();
|
||
|
|
||
|
/**
|
||
|
Must be called on the end of the diff.
|
||
|
*/
|
||
|
void end();
|
||
|
|
||
|
/**
|
||
|
Sets the title of the left data source.
|
||
|
*/
|
||
14 years ago
|
void setLeftSourceTitle( const TQString &title );
|
||
15 years ago
|
|
||
|
/**
|
||
|
Sets the title of the right data source.
|
||
|
*/
|
||
14 years ago
|
void setRightSourceTitle( const TQString &title );
|
||
15 years ago
|
|
||
|
/**
|
||
|
Adds a field which is only available in the left data source.
|
||
|
*/
|
||
14 years ago
|
void additionalLeftField( const TQString &id, const TQString &value );
|
||
15 years ago
|
|
||
|
/**
|
||
|
Adds a field which is only available in the right data source.
|
||
|
*/
|
||
14 years ago
|
void additionalRightField( const TQString &id, const TQString &value );
|
||
15 years ago
|
|
||
|
/**
|
||
|
Adds a conflict between two fields.
|
||
|
*/
|
||
14 years ago
|
void conflictField( const TQString &id, const TQString &leftValue,
|
||
|
const TQString &rightValue );
|
||
15 years ago
|
|
||
|
void addDisplay( DiffAlgoDisplay *display );
|
||
|
void removeDisplay( DiffAlgoDisplay *display );
|
||
|
|
||
|
|
||
|
private:
|
||
14 years ago
|
TQValueList<DiffAlgoDisplay*> mDisplays;
|
||
15 years ago
|
};
|
||
|
|
||
|
}
|
||
|
|
||
|
#endif
|