如何利用sqlite的撤销/重做功能? [英] How to utilize sqlite for undo/redo features?
问题描述
我在写一个桌面应用程序,在C ++中进行矢量绘图,并考虑使用sqlite来回退我的撤消/重做功能。
I'm writing a desktop application to do vector drawing in C++, and considering using sqlite to back my undo/redo feature.
有人使用sqlite进行撤销/重做功能吗?
Has anybody used sqlite for undo/redo features? How does it work out for you?
澄清:
我知道堆栈的方法,我有甚至实现一个应用程序的方法。我遇到的问题是,一段时间后很难维护。
I was aware of the stack approach, I have even implemented one application with that approach. The problem I encountered was that it becomes hard to maintain after a while.
我用sqlite的意思是,我将我的整个内存中的数据结构映射到一个sqlite数据库,并让sqlite为我做差异和修订。
如果我创建一个内存数据库,速度不应该是一个问题。
What I meant by utilizing sqlite is that I will map my entire in-memory data structure into a sqlite database, and let the sqlite do the diff and revision for me. Speed should not be a issue if I create a in-memory database.
这是想法,我想知道是否可以工作。
That was the idea and I was wondering if that could work.
推荐答案
当SQLite数据库是应用程序的数据文件格式时,使用SQLite来回退撤消/重做是有意义的。有关如何使用SQLite触发器执行此操作的说明,请参见 SQLite网站。
It makes sense to use SQLite to back undo/redo when an SQLite database is the application's data file format. See the SQLite website for an explanation of how to do this with SQLite triggers.
这篇关于如何利用sqlite的撤销/重做功能?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!