9
|
1 #ifndef __core__date_h
|
|
2 #define __core__date_h
|
|
3 #include "json.h"
|
|
4 #include <QDate>
|
|
5 #include <cstdint>
|
|
6 class Date {
|
|
7 public:
|
|
8 Date();
|
|
9 Date(int32_t y);
|
|
10 Date(int32_t y, int8_t m, int8_t d);
|
|
11 void SetYear(int32_t y);
|
|
12 void SetMonth(int8_t m);
|
|
13 void SetDay(int8_t d);
|
|
14 void VoidYear();
|
|
15 void VoidMonth();
|
|
16 void VoidDay();
|
|
17 int32_t GetYear() const;
|
|
18 int8_t GetMonth() const;
|
|
19 int8_t GetDay() const;
|
|
20 QDate GetAsQDate() const;
|
|
21 nlohmann::json GetAsAniListJson() const;
|
|
22 bool operator<(const Date& other) const;
|
|
23 bool operator>(const Date& other) const;
|
|
24 bool operator<=(const Date& other) const;
|
|
25 bool operator>=(const Date& other) const;
|
|
26
|
|
27 private:
|
|
28 std::shared_ptr<int32_t> year;
|
|
29 std::shared_ptr<int8_t> month;
|
|
30 std::shared_ptr<int8_t> day;
|
|
31 };
|
|
32 #endif // __core__date_h
|