String BinDiff(const String& base, const String& data)
Efficiently encodes differences between base and data.
String BinUndiff(const String& base, const String& bin_diff)
With bin_diff being the return value of BinDiff restores data with given base.
class BinUndoRedo
Efficiently stores a list of similar String data. Standard usage for implementing Undo/Redo - application would serialize the snapshot of content into binary String then use Commit to store data into BinUndoRedo. Lately, it can retrieve binary String with Undo/Redo a serialize it back into content.
void Reset(const String& current)
Sets the initial data content. This is typically used after loading the data into application or creating a new content.
bool Commit(const String& current, int limit = 4096 *1024)
Adds a snapshot of content current effectively creating single undo step. limit represents maximum memory that can be used to store undo steps (when there is more, oldest steps are dropped).
bool IsUndo() const
Returns true if undo steps are available.
bool IsRedo() const
Returns true if undo steps are available..
String Undo(const String& current)
Given snapshot of content current, does one undo step and returns content snapshot after undo.
String Redo(const String& current)
Given snapshot of content current, does one redo step and returns content snapshot after redo.
|