QtPass  1.2.0
Multi-platform GUI for pass, the standard unix password manager.
simpletransaction.cpp
Go to the documentation of this file.
1 #include "simpletransaction.h"
2 #include "debughelper.h"
3 #include <utility>
4 
5 using std::pair;
6 using namespace Enums;
7 
9  dbg() << "START" << transactionDepth;
10  transactionDepth++;
11 }
12 
14  dbg() << "ADD" << transactionDepth << id;
15  if (transactionDepth > 0) {
16  lastInTransaction = id;
17  } else {
18  transactionQueue.push(pair<PROCESS, PROCESS>(id, id));
19  }
20 }
21 
23  dbg() << "END" << transactionDepth;
24  if (transactionDepth > 0) {
25  transactionDepth--;
26  if (transactionDepth == 0 && lastInTransaction != INVALID) {
27  transactionQueue.push(pair<PROCESS, PROCESS>(lastInTransaction, pid));
28  lastInTransaction = INVALID;
29  }
30  }
31 }
32 
34  dbg() << "OVER" << transactionDepth << id;
35  if (!transactionQueue.empty() && id == transactionQueue.front().first) {
36  PROCESS ret = transactionQueue.front().second;
37  transactionQueue.pop();
38  return ret;
39  }
40  return INVALID;
41 }
Enums::PROCESS transactionIsOver(Enums::PROCESS)
transactionIsOver checks wheather currently finished process is last in current transaction ...
void transactionAdd(Enums::PROCESS)
transactionAdd If called after call to transactionStart() and before transactionEnd(), this method marks given process as next step in transaction. Otherwise it marks given process as the only step in transaction(it&#39;s value is treated as transaction result).
PROCESS
Definition: enums.h:16
#define dbg()
Definition: debughelper.h:7
Enumerators for configuration and runtime items.
void transactionStart()
transactionStart this function is used to mark start of the sequence of processes that shall be treat...
void transactionEnd(Enums::PROCESS)
transactionEnd marks end of transaction