#include <QList>
Go to the source code of this file.
|
template<class SrcItem , class TrgItem , class TreeData > |
TrgItem | synchronize (const SrcItem &r1, const TrgItem &r2, const TreeData &td) |
| Synchronize two data trees by recurive comparing of the corresponding items. More...
|
|
template<class SrcItem , class TrgItem , class TreeData > |
QList< DiffItem< SrcItem,
TrgItem > > | diffSiblings (const SrcItem &src, const TrgItem &trg, const TreeData &td) |
| Compare children of the source and target trees to find differences. More...
|
|
template<class SrcItem , class TrgItem , class TreeData > |
TrgItem | createSubTree (const SrcItem &src, const TrgItem &parent, const TrgItem &after, const TreeData &td) |
| Create an item with all its children recursively in the target tree. More...
|
|
template<class SrcItem , class TrgItem , class TreeData > |
const QList< TrgItem >
::const_iterator | findEqual (const SrcItem &it, const typename QList< TrgItem >::const_iterator &first, const typename QList< TrgItem >::const_iterator &last, const TreeData &td) |
| Find the item in the target tree which correspond to the specified source tree item. More...
|
|
template<class SrcItem , class TrgItem , class TreeData >
TrgItem createSubTree |
( |
const SrcItem & |
src, |
|
|
const TrgItem & |
parent, |
|
|
const TrgItem & |
after, |
|
|
const TreeData & |
td |
|
) |
| |
- Parameters
-
src | source tree item |
parent | parent item in the target tree |
after | item in the target tree after which new item shoud be inserted |
td | functor class |
- Returns
- created item
- See Also
- synchronize()
template<class SrcItem , class TrgItem , class TreeData >
template<class SrcItem , class TrgItem , class TreeData >
const QList< TrgItem >::const_iterator findEqual |
( |
const SrcItem & |
it, |
|
|
const typename QList< TrgItem >::const_iterator & |
first, |
|
|
const typename QList< TrgItem >::const_iterator & |
last, |
|
|
const TreeData & |
td |
|
) |
| |
- Parameters
-
it | source item for which correspondence is to be found |
first | iterator pointing to the item in the list l from which search shoud be started |
last | iterator pointing to the item in the list l the search to be finished at |
td | functor class |
- Returns
- iterator pointing to the item in the list if the correspondence is found or iterator last if the correspondence is not found
- See Also
- synchronize()
template<class SrcItem , class TrgItem , class TreeData >
TrgItem synchronize |
( |
const SrcItem & |
r1, |
|
|
const TrgItem & |
r2, |
|
|
const TreeData & |
td |
|
) |
| |
- Parameters
-
r1 | starting item from the source data tree |
r2 | starting item from the target data tree |
td | functor class |
- Returns
- the target tree item (updated or just created) corresponding to the starting data object
Actual comparing of the items and the syncronization of the trees is performed by the functor class which is passed as the last parameter of the function. The functor class should implement the following methods:
- bool isEqual( const SrcItem&
src
, const TrgItem& tgt
) const;
- src source tree item
- tgt target tree item
- compares items and returns
true
if the items are equal (correspond to each other)
- SrcItem nullSrc() const;
- returns null source tree itemm
- TrgItem nullTrg() const
- returns null target tree item
- TrgItem createItem( const SrcItem&
src
, const TrgItem& parent
, const TrgItem& after
) const;
- src source item
- parent parent target item
- after target tree item after which new item shoud be inserted (if null, the item is added to the end)
- creates new ite in the target tree which correspond to the source item and returns created item
- void updateItem( const SrcItem&
src
, const TrgItem& tgt
) const;
- src source tree item
- tgt the item in the target tree to be updated
- updates target treeitem
- void deleteItemWithChildren( const TrgItem&
tgt
) const;
- tgt the item in the target tree to be removed
- deletes target tree item (recursively)
- QList<SrcItem> children( const SrcItem&
parent
) const;
- parent the parent item in the source tree
- returns the child items list
- QList<TrgItem> children( const TrgItem&
parent
) const;
- parent the parent item in the target tree
- returns the child items list
- TrgItem parent( const TrgItem&
tgt
) const;
- tgt target tree item
- returns the item which is parent for the specified source tree item
References createSubTree(), diffSiblings(), DiffItem< SrcItem, TrgItem >::mySrc, and DiffItem< SrcItem, TrgItem >::myTrg.