Revision 775829

Go back to digest for 17th February 2008

Features in Utilities

Friedrich W. H. Kossebau committed changes in /trunk/playground/utils/okteta/core/piecetable:

Added: first approach to a piecetable structure, pretty Leichtwasser-matrosig (works, but has some flaws).

What is a "Piece table":
stores both original data and a buffer with all new input, current data is defined by a list of pieces pointing to offsets in one of the buffers and some length. Changes are done by appending to the input buffer if any and manipulating the list of pieces.
In use by Abiword, Qt 4 QTextDocument and others.

And it is an Alpha version of the code, to get things at least working, don't judge too quickly, please. Help is welcome :)

It was tried to have it to be ignorant of the supported data structure, only dependencies so far are primitive utility classes KSection and Co, no used knowledge of KAbstractByteArrayModel or else, cmp. namespace KHE vs. namespace KHECore.
So other interested parties might try to make use of this code, too. They are welcomed.

But the undo/redo stuff, aka revertable changes, seems to force one to finally use structures from the basic data model, e.g. otherwise a list of piecetable changes would have to been transformed into a list of bytearray changes.
And no, currently I do not want to rely the KAbstractByteArrayModel on the piecetable library, neither. Perhaps a common usage can be done by turning the piecetable lib into template code...

File Changes

Added 41 files
  • /trunk/playground/utils/okteta/core/piecetable
  •   /abstractpiecetablechange.cpp
  •   /abstractpiecetablechange.h
  •   /insertpiecetablechange.cpp
  •   /insertpiecetablechange.h
  •   /piece.h
  •   /piecelist.cpp
  •   /piecelist.h
  •   /piecetable.cpp
  •   /piecetable.h
  •   /piecetablechangehistory.cpp
  •   /piecetablechangehistory.h
  •   /removepiecetablechange.cpp
  •   /removepiecetablechange.h
  •   /replacepiecetablechange.cpp
  •   /replacepiecetablechange.h
  •   /revertablepiecetable.cpp
  •   /revertablepiecetable.h
  •   /swaprangespiecetablechange.cpp
  •   /swaprangespiecetablechange.h
  •   /tests
  •   /tests/abstractpiecetablechangeiftest.cpp
  •   /tests/abstractpiecetablechangeiftest.h
  •   /tests/CMakeLists.txt
  •   /tests/insertpiecetablechangeabstractpiecetablechangeiftest.cpp
  •   /tests/piecetablechangehistorytest.cpp
  •   /tests/piecetablechangehistorytest.h
  •   /tests/piecetabletest.cpp
  •   /tests/piecetabletest.h
  •   /tests/piecetest.cpp
  •   /tests/piecetest.h
  •   /tests/removepiecetablechangeabstractpiecetablechangeiftest.cpp
  •   /tests/replacepiecetablechangeabstractpiecetablechangeiftest.cpp
  •   /tests/revertablepiecetabletest.cpp
  •   /tests/revertablepiecetabletest.h
  •   /tests/swaprangespiecetablechangeabstractpiecetablechangeiftest.cpp
  •   /tests/testpiecetablechange.cpp
  •   /tests/testpiecetablechange.h
  •   /tests/testpiecetablechangeabstractpiecetablechangeiftest.cpp
  •   /tests/testpiecetablechangetest.cpp
  •   /tests/testpiecetablechangetest.h
41 files changed in total