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, const Value& info = Value())
Sets the initial data content. This is typically used after loading the data into application or creating a new content. info is additional client code information that is associated with each undo/redo step and can be retrieved. Client code might typically use this information to manage resources that are not stored within current data.
bool Commit(const String& current, const Value& info, int limit = 4096 *1024)
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). info is additional client code information that is associated with each undo/redo step and can be retrieved. Client code might typically use this information to manage resources that are not stored within current data.
bool IsUndo() const
Returns true if undo steps are available.
bool IsRedo() const
Returns true if undo steps are available..
int GetUndoCount() const
Returns the number of undo steps.
int GetRedoCount() const
Returns the number of redo steps.
bool DropUndo()
Deletes oldest undo step.
bool DropRedo()
Deletes oldest redo step.
Value GetUndoInfo(int i) const
Returns the information associated with undo step i.
Value GetRedoInfo(int i) const
Returns the information associated with redo step i.
Value GetCommitInfo() const
Returns the information associated with current commit.
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.
|