This repository has been archived by the owner on Dec 11, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathresqliteun.h
145 lines (118 loc) · 3.78 KB
/
resqliteun.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
/* ========================================================================= */
/* ------------------------------------------------------------------------- */
/**
* @file resqliteun.h
* @brief Declarations for ReSqliteUn class
* @author Nicu Tofan <nicu.tofan@gmail.com>
* @copyright Copyright 2014 piles contributors. All rights reserved.
* This file is released under the
* [MIT License](http://opensource.org/licenses/mit-license.html)
*/
#ifndef GUARD_RESQLITEUN_H_INCLUDE
#define GUARD_RESQLITEUN_H_INCLUDE
/* ------------------------------------------------------------------------- */
/* ========================================================================= */
//
//
//
//
/* INCLUDES ------------------------------------------------------------ */
#include <resqliteun/resqliteun-manager.h>
#include <resqliteun/resqliteun-util.h>
#include <QString>
#include <QList>
/* INCLUDES ============================================================ */
//
//
//
//
/* DEFINITIONS --------------------------------------------------------- */
/* DEFINITIONS ========================================================= */
//
//
//
//
/* CLASS --------------------------------------------------------------- */
//! Adds undo-redo capabilities to a sqlite database.
class RESQLITEUN_EXPORT ReSqliteUn :
public ReSqliteUnManager, public ReSqliteUnUtil {
//
//
//
//
/* DEFINITIONS ----------------------------------------------------- */
/* DEFINITIONS ===================================================== */
//
//
//
//
/* DATA ------------------------------------------------------------ */
public:
void * db_; /**< the actual sqlite database */
bool is_active_; /**< is the instance active or not? */
bool in_undo_; /**< are we performing an undo or a redo (valid when is_active_) */
/* DATA ============================================================ */
//
//
//
//
/* FUNCTIONS ------------------------------------------------------- */
public:
//! Default constructor.
ReSqliteUn (
void *db);
//! Destructor.
virtual ~ReSqliteUn ();
//! Creates a restore point.
ReSqliteUn::SqLiteResult
begin (
const QString &s_name,
qint64 * entry_id=NULL);
//! Closes a restore point.
ReSqliteUn::SqLiteResult
end ();
//! Creates the triggers for mentioned table.
ReSqliteUn::SqLiteResult
attachToTable (
const QString &table,
UpdateBehaviour update_kind);
//! Do an Undo or Redo.
ReSqliteUn::SqLiteResult
performUndoRedo (
bool for_undo,
QString &s_error);
//! Do multiple Undo or Redo.
ReSqliteUn::SqLiteResult
performUndoRedo (
int steps,
bool for_undo,
QString &s_error);
//! Get the number of steps required to reach a certain id.
ReSqliteUn::SqLiteResult
stepsToGoal (
bool for_undo,
qint64 goal_id,
int &steps);
//! Get the number of entries in the temporary table by kind.
SqLiteResult
count (
qint64 & undo_entries,
qint64 & redo_entries) const;
//! Get the id of the undo or redo entry that should be used right now.
qint64
getActiveId (
UndoRedoType ty = CurrentUndoRedo) const;
/* FUNCTIONS ======================================================= */
//
//
//
//
}; // class ReSqliteUn
/* CLASS =============================================================== */
//
//
//
//
#endif // GUARD_RESQLITEUN_H_INCLUDE
/* ------------------------------------------------------------------------- */
/* ========================================================================= */