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