]> Git Repo - VerusCoin.git/blob - src/coincontrol.h
Merge pull request #5219
[VerusCoin.git] / src / coincontrol.h
1 // Copyright (c) 2011-2013 The Bitcoin developers
2 // Distributed under the MIT/X11 software license, see the accompanying
3 // file COPYING or http://www.opensource.org/licenses/mit-license.php.
4
5 #ifndef BITCOIN_COINCONTROL_H
6 #define BITCOIN_COINCONTROL_H
7
8 #include "primitives/transaction.h"
9
10 /** Coin Control Features. */
11 class CCoinControl
12 {
13 public:
14     CTxDestination destChange;
15
16     CCoinControl()
17     {
18         SetNull();
19     }
20
21     void SetNull()
22     {
23         destChange = CNoDestination();
24         setSelected.clear();
25     }
26
27     bool HasSelected() const
28     {
29         return (setSelected.size() > 0);
30     }
31
32     bool IsSelected(const uint256& hash, unsigned int n) const
33     {
34         COutPoint outpt(hash, n);
35         return (setSelected.count(outpt) > 0);
36     }
37
38     void Select(const COutPoint& output)
39     {
40         setSelected.insert(output);
41     }
42
43     void UnSelect(const COutPoint& output)
44     {
45         setSelected.erase(output);
46     }
47
48     void UnSelectAll()
49     {
50         setSelected.clear();
51     }
52
53     void ListSelected(std::vector<COutPoint>& vOutpoints)
54     {
55         vOutpoints.assign(setSelected.begin(), setSelected.end());
56     }
57
58 private:
59     std::set<COutPoint> setSelected;
60 };
61
62 #endif // BITCOIN_COINCONTROL_H
This page took 0.026281 seconds and 4 git commands to generate.