Mercurial > minori
annotate include/core/date.h @ 175:9b10175be389
dep/json: update to v3.11.3
anime/db: save anime list to database, very much untested and likely won't work as intended
| author | Paper <mrpapersonic@gmail.com> |
|---|---|
| date | Thu, 30 Nov 2023 13:52:26 -0500 |
| parents | f88eda79c60a |
| children | 9613d72b097e |
| rev | line source |
|---|---|
| 9 | 1 #ifndef __core__date_h |
| 2 #define __core__date_h | |
| 85 | 3 |
|
174
f88eda79c60a
anime/db: add some more json functionality, still doesn't compile :/
Paper <mrpapersonic@gmail.com>
parents:
85
diff
changeset
|
4 #include "core/json.h" |
| 9 | 5 #include <QDate> |
| 6 #include <cstdint> | |
| 85 | 7 |
| 9 | 8 class Date { |
| 9 public: | |
| 10 Date(); | |
| 51 | 11 Date(unsigned int y); |
| 12 Date(unsigned int y, unsigned int m, unsigned int d); | |
| 13 Date(const QDate& date); | |
|
174
f88eda79c60a
anime/db: add some more json functionality, still doesn't compile :/
Paper <mrpapersonic@gmail.com>
parents:
85
diff
changeset
|
14 Date(const nlohmann::json& json); |
|
47
d8eb763e6661
information.cpp: add widgets to the list tab, and add an
Paper <mrpapersonic@gmail.com>
parents:
9
diff
changeset
|
15 bool IsValid() const; |
| 51 | 16 void SetYear(unsigned int y); |
| 17 void SetMonth(unsigned int m); | |
| 18 void SetDay(unsigned int d); | |
| 9 | 19 void VoidYear(); |
| 20 void VoidMonth(); | |
| 21 void VoidDay(); | |
| 51 | 22 unsigned int GetYear() const; |
| 23 unsigned int GetMonth() const; | |
| 24 unsigned int GetDay() const; | |
| 9 | 25 QDate GetAsQDate() const; |
| 26 nlohmann::json GetAsAniListJson() const; | |
| 27 bool operator<(const Date& other) const; | |
| 28 bool operator>(const Date& other) const; | |
| 29 bool operator<=(const Date& other) const; | |
| 30 bool operator>=(const Date& other) const; | |
| 31 | |
| 32 private: | |
|
174
f88eda79c60a
anime/db: add some more json functionality, still doesn't compile :/
Paper <mrpapersonic@gmail.com>
parents:
85
diff
changeset
|
33 /* this implementation sucks and we should really use a struct instead */ |
| 51 | 34 std::shared_ptr<unsigned int> year; |
| 35 std::shared_ptr<unsigned int> month; | |
| 36 std::shared_ptr<unsigned int> day; | |
| 9 | 37 }; |
| 85 | 38 |
| 9 | 39 #endif // __core__date_h |
