-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathshared.h
117 lines (91 loc) · 3.81 KB
/
shared.h
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
#ifndef SHARED_H
#define SHARED_H
#include <memory>
#include <ratio>
#define ISHSC
using std::shared_ptr;
using std::make_shared;
#ifdef __wasm__
#define _Mem_fn __mem_fn
#endif
struct Points {
long points;
explicit constexpr Points(long x)
: points(x) { }
Points& operator+=(Points b) { points += b.points; return *this; }
Points& operator-=(Points b) { points -= b.points; return *this; }
Points& operator*=(Points b) { points *= b.points; return *this; }
Points& operator/=(Points b) { points /= b.points; return *this; }
Points& operator%=(Points b) { points %= b.points; return *this; }
bool Min(const Points& p) const { return points < p.points ? points : p.points; }
bool Max(const Points& p) const { return p.Min(*this); }
};
inline constexpr auto operator"" _cp(unsigned long long p) { return Points{ (long) p }; }
inline Points operator*(long a, Points b) { return Points(a * b.points); }
inline Points operator*(Points a, long b) { return Points(a.points * b); }
inline Points operator*(Points a, Points b) { return Points(a.points * b.points); }
inline Points operator/(long a, Points b) { return Points(a / b.points); }
inline Points operator/(Points a, long b) { return Points(a.points / b); }
inline Points operator/(Points a, Points b) { return Points(a.points / b.points); }
inline Points operator%(long a, Points b) { return Points(a / b.points); }
inline Points operator%(Points a, long b) { return Points(a.points / b); }
inline Points operator%(Points a, Points b) { return Points(a.points / b.points); }
inline Points operator+(long a, Points b) { return Points(a + b.points); }
inline Points operator+(Points a, long b) { return Points(a.points + b); }
inline Points operator+(Points a, Points b) { return Points(a.points + b.points); }
inline Points operator-(long a, Points b) { return Points(a - b.points); }
inline Points operator-(Points a, long b) { return Points(a.points - b); }
inline Points operator-(Points a, Points b) { return Points(a.points - b.points); }
inline bool operator<(long a, Points b) { return a < b.points; }
inline bool operator<(Points a, long b) { return a.points < b; }
inline bool operator<(Points a, Points b) { return a.points < b.points; }
inline bool operator<=(long a, Points b) { return a <= b.points; }
inline bool operator<=(Points a, long b) { return a.points <= b; }
inline bool operator<=(Points a, Points b) { return a.points <= b.points; }
inline bool operator==(long a, Points b) { return a == b.points; }
inline bool operator==(Points a, long b) { return a.points == b; }
inline bool operator==(Points a, Points b) { return a.points == b.points; }
inline bool operator>(long a, Points b) { return a > b.points; }
inline bool operator>(Points a, long b) { return a.points > b; }
inline bool operator>(Points a, Points b) { return a.points > b.points; }
inline bool operator>=(long a, Points b) { return a >= b.points; }
inline bool operator>=(Points a, long b) { return a.points >= b; }
inline bool operator>=(Points a, Points b) { return a.points >= b.points; }
class At {
private:
int _x;
int _y;
public:
At(int x, int y)
: _x(x)
, _y(y) { }
At(const At& a)
: _x(a._x)
, _y(a._y) { }
At(At&& a)
: _x(a._x)
, _y(a._y) { }
const int& x = _x;
const int& y = _y;
};
class Size {
private:
int _l;
int _h;
public:
Size(int l = -1, int h = -1)
: _l(l)
, _h(h) { }
Size(const Size& a)
: _l(a._l)
, _h(a._h) { }
Size(Size&& a)
: _l(a._l)
, _h(a._h) { }
const int& l = _l;
const int& h = _h;
};
#define NOTES Sheet::ref().getUi()->notes
#define DBG(x) NOTES->setPlainText(NOTES->toPlainText() + "\n" + x)
#define DBGVar(x) DBG(QString(#x ": %1").arg(x))
#endif // SHARED_H