kitchensync Library API Documentation

KSync::Syncer Class Reference

This class provides syncing of sets of data entries. More...

#include <syncer.h>

Collaboration diagram for KSync::Syncer:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 Syncer (SyncUi *ui=0, SyncAlgorithm *algorithm=0)
void setSyncAlgorithm (SyncAlgorithm *)
void setSyncUi (SyncUi *)
void addSyncee (Syncee *)
void clear ()
void sync ()
void syncAllToTarget (Syncee *target, bool writeback=false)
void syncToTarget (Syncee *syncee, Syncee *target, bool override=false)

Detailed Description

This class provides syncing of sets of data entries.

Author:
Cornelius Schumacher, zecke
See also:
SyncEntry, Syncee, SyncUi
The Syncer class provides the top level framework for syncing. It implements the actual syncing algorithm, which operates on data objects implementing the Syncee and SyncEntry interfaces. By this mechanism the syncing algorithm is decoupled from the concrete type of data and has to be implemented only once.

To perform a syncing process you have to create objects of the concrete subclasses of Syncee, representing the type of the data to be synced. They are added to Syncer with the function addSyncee(). When all data sets to be synced are added, call the sync() functions to perform the actual syncing.

For conflict resolution, a user interface is needed. This has to be a subclass of SyncUi and is provided, when constructing a Syncer instance.

Definition at line 54 of file syncer.h.


Constructor & Destructor Documentation

Syncer::Syncer SyncUi ui = 0,
SyncAlgorithm algorithm = 0
 

Create a Syncer instance.

You have to provide an instance of a conflict resolution user interface, which is used to resolve conflicts in the synced data, which cannot be resolved automatically. The UI does not necessarily have to be interactive.

Definition at line 33 of file syncer.cpp.


Member Function Documentation

void Syncer::setSyncAlgorithm SyncAlgorithm  ) 
 

Sets the syncing algorithm which is used to perform the sync.

Definition at line 124 of file syncer.cpp.

void Syncer::setSyncUi SyncUi  ) 
 

Sets user interface handler which is used for resolving conflicts.

Definition at line 131 of file syncer.cpp.

References KSync::SyncAlgorithm::setUi().

void Syncer::addSyncee Syncee  ) 
 

Add a data set, which is to be synced.

Definition at line 53 of file syncer.cpp.

void Syncer::clear  ) 
 

Removes all Syncee objects added with addSyncee from the Syncer.

Definition at line 58 of file syncer.cpp.

void Syncer::sync  ) 
 

Sync all data sets.

After execution of this functions all data sets, which have been added to Syncer contain the same set of data.

This function might call conflict resolution functions of the SyncUi object.

Definition at line 63 of file syncer.cpp.

References KSync::Syncee::identifier(), KSync::Syncee::loadLog(), KSync::Syncee::saveLog(), and syncToTarget().

void Syncer::syncAllToTarget Syncee target,
bool  writeback = false
 

Sync all data sets with a target data sets.

After execution of this function the target Syncee data set contains a combination of all data sets added to Syncer. The added data sets are not changed.

This function might call conflict resolution functions of the SyncUi object.

Definition at line 99 of file syncer.cpp.

References KSync::Syncee::saveLog(), and syncToTarget().

void Syncer::syncToTarget Syncee syncee,
Syncee target,
bool  override = false
 

Sync one specific data set to a target data set.

After execution of this function the target contains the combination of the two data sets. Only the target is changed.

This function might call conflict resolution functions of the SyncUi object.

Definition at line 119 of file syncer.cpp.

References KSync::SyncAlgorithm::syncToTarget().

Referenced by sync(), and syncAllToTarget().


The documentation for this class was generated from the following files:
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:54 2007 by doxygen 1.4.2 written by Dimitri van Heesch, © 1997-2003