Merge branch 'patch' of ssh://github.com/svost/novacoin into svost-patch
[novacoin.git] / src / coincontrol.h
1 #ifndef COINCONTROL_H
2 #define COINCONTROL_H
3
4 /** Coin Control Features. */
5 class CCoinControl
6 {
7 public:
8     CTxDestination destChange;
9
10     CCoinControl()
11     {
12         SetNull();
13     }
14         
15     void SetNull()
16     {
17         destChange = CNoDestination();
18         setSelected.clear();
19     }
20     
21     bool HasSelected() const
22     {
23         return (setSelected.size() > 0);
24     }
25     
26     bool IsSelected(const uint256& hash, unsigned int n) const
27     {
28         COutPoint outpt(hash, n);
29         return (setSelected.count(outpt) > 0);
30     }
31     
32     void Select(COutPoint& output)
33     {
34         setSelected.insert(output);
35     }
36     
37     void UnSelect(COutPoint& output)
38     {
39         setSelected.erase(output);
40     }
41     
42     void UnSelectAll()
43     {
44         setSelected.clear();
45     }
46
47     void ListSelected(std::vector<COutPoint>& vOutpoints)
48     {
49         vOutpoints.assign(setSelected.begin(), setSelected.end());
50     }
51         
52 private:
53     std::set<COutPoint> setSelected;
54
55 };
56
57 #endif // COINCONTROL_H