-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvote.hpp
49 lines (41 loc) · 1.35 KB
/
vote.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#include <vector>
#include <string>
#include "partylist.cpp"
#include "settings.h"
#pragma once
namespace panachage
{
class Vote
{
protected:
int copies;
int ln_parsed;
bool from_file;
inline Vote(const int copies = 1) : copies(copies), from_file(false) {}
public:
static inline configt config = DEFAULT_CONFIG;
virtual void count(std::vector<partylist *> lists) = 0;
virtual bool validate() = 0;
/* Indicates whether the parameter vote is less than this vote. Ignores the number of copies.
* If two votes of different implementing classes are compared, the comparison will return false.
* @param vote The vote to compare to.
*/
virtual bool operator<(const Vote &vote) const = 0;
virtual std::string encode() const = 0;
inline void setCopies(const int copies) { this->copies = copies; }
inline int getCopies() const { return copies; }
inline void setLnParsed(const int ln_parsed)
{
this->ln_parsed = ln_parsed;
this->from_file = true;
}
inline int getLnParsed() const { return ln_parsed; }
struct PtrComparator
{
inline bool operator()(const Vote *a, const Vote *b) const
{
return *a < *b;
}
};
};
}