QtPass 1.4.0
Multi-platform GUI for pass, the standard unix password manager.
Loading...
Searching...
No Matches
simpletransaction.cpp
Go to the documentation of this file.
1#include "simpletransaction.h"
2#include <utility>
3
4#ifdef QT_DEBUG
5#include "debughelper.h"
6#endif
7
8using std::pair;
9using namespace Enums;
10
15#ifdef QT_DEBUG
16 dbg() << "START" << transactionDepth;
17#endif
18 transactionDepth++;
19}
20
26#ifdef QT_DEBUG
27 dbg() << "ADD" << transactionDepth << id;
28#endif
29 if (transactionDepth > 0) {
30 lastInTransaction = id;
31 } else {
32 transactionQueue.push(pair<PROCESS, PROCESS>(id, id));
33 }
34}
35
41#ifdef QT_DEBUG
42 dbg() << "END" << transactionDepth;
43#endif
44 if (transactionDepth > 0) {
45 transactionDepth--;
46 if (transactionDepth == 0 && lastInTransaction != INVALID) {
47 transactionQueue.push(pair<PROCESS, PROCESS>(lastInTransaction, pid));
48 lastInTransaction = INVALID;
49 }
50 }
51}
52
59#ifdef QT_DEBUG
60 dbg() << "OVER" << transactionDepth << id;
61#endif
62 if (!transactionQueue.empty() && id == transactionQueue.front().first) {
63 PROCESS ret = transactionQueue.front().second;
64 transactionQueue.pop();
65 return ret;
66 }
67 return INVALID;
68}
void transactionEnd(Enums::PROCESS)
transactionEnd marks end of transaction
void transactionAdd(Enums::PROCESS)
transactionAdd If called after call to transactionStart() and before transactionEnd(),...
void transactionStart()
transactionStart this function is used to mark start of the sequence of processes that shall be treat...
Enums::PROCESS transactionIsOver(Enums::PROCESS)
transactionIsOver checks wheather currently finished process is last in current transaction
#define dbg()
Definition: debughelper.h:7
Enumerators for configuration and runtime items.
PROCESS
Definition: enums.h:16
@ INVALID
Definition: enums.h:33