kitchensync Library API Documentation

syncentry.h

00001 /*
00002     This file is part of KitchenSync.
00003 
00004     Copyright (c) 2002 Cornelius Schumacher <schumacher@kde.org>
00005     Copyright (c) 2002 Holger Freyther <zecke@handhelds.org>
00006 
00007     This library is free software; you can redistribute it and/or
00008     modify it under the terms of the GNU Library General Public
00009     License as published by the Free Software Foundation; either
00010     version 2 of the License, or (at your option) any later version.
00011 
00012     This library is distributed in the hope that it will be useful,
00013     but WITHOUT ANY WARRANTY; without even the implied warranty of
00014     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00015     Library General Public License for more details.
00016 
00017     You should have received a copy of the GNU Library General Public License
00018     along with this library; see the file COPYING.LIB.  If not, write to
00019     the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
00020     Boston, MA 02111-1307, USA.
00021 */
00022 #ifndef KSYNC_SYNCENTRY_H
00023 #define KSYNC_SYNCENTRY_H
00024 
00025 #include <qstring.h>
00026 #include <qptrlist.h>
00027 
00028 namespace KPIM {
00029 class DiffAlgo;
00030 }
00031 
00032 namespace KSync {
00033 
00034 class Syncee;
00035 
00048 class SyncEntry
00049 {
00050   public:
00051     typedef QPtrList<SyncEntry> PtrList;
00052 
00053     enum Equalness { Different = -1, Equal = 0, EqualButModifiedThis = 1,
00054                      EqualButModifiedOther = 2, EqualButModifiedBoth = 3 };
00055 
00056     enum Status { Undefined = -1, Added = 0, Modified=1, Removed = 2 };
00057 
00062     SyncEntry( Syncee *parent );
00063     SyncEntry( const SyncEntry & );
00064     virtual ~SyncEntry();
00065 
00069     virtual QString type() const = 0;
00070 
00075     virtual QString name() = 0;
00076 
00083     virtual QString id() = 0;
00084 
00085     // We should remove the setId function. The id is determined by the
00086     //underlying data, not by externally setting it.
00090     virtual void setId( const QString& id );
00091 
00103     virtual QString timestamp() = 0;
00104 
00110     virtual bool equals( SyncEntry * ) = 0;
00111 
00120     virtual int match( SyncEntry *entry );
00121 
00130     virtual int compareTo( SyncEntry *entry );
00131 
00136     virtual int state() const;
00137 
00141     virtual bool wasAdded() const;
00142 
00147     virtual bool wasModified() const;
00148 
00152     virtual bool wasRemoved() const;
00153 
00157     virtual void setState( int state = Undefined );
00158 
00159 
00163     virtual void setSyncState( int state = Undefined );
00164 
00168     virtual int syncState() const;
00169 
00170 
00175     virtual SyncEntry *clone() = 0;
00176 
00180     void setSyncee( Syncee * );
00181 
00185     Syncee *syncee();
00186 
00191     virtual bool mergeWith( SyncEntry * );
00192 
00196     void setDontSync( bool );
00197 
00198     bool dontSync() const;
00199 
00204     virtual KPIM::DiffAlgo* diffAlgo( SyncEntry*, SyncEntry* );
00205 
00206   private:
00207     int mState;
00208     int mSyncState;
00209     Syncee *mSyncee;
00210     bool mDontSync;
00211 
00212     class SyncEntryPrivate;
00213     SyncEntryPrivate *d;
00214 };
00215 
00216 }
00217 
00218 #endif
KDE Logo
This file is part of the documentation for kitchensync Library Version 3.3.2.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Fri Dec 21 14:23:41 2007 by doxygen 1.4.2 written by Dimitri van Heesch, © 1997-2003