Mercurial > minori
annotate include/core/date.h @ 122:bc218c9d2ea6
strings: convert ToInt() to be a template
ini: conform to new strings.cc changes
author | Paper <mrpapersonic@gmail.com> |
---|---|
date | Wed, 08 Nov 2023 21:36:09 -0500 |
parents | c69230dc2b5d |
children | f88eda79c60a |
rev | line source |
---|---|
9 | 1 #ifndef __core__date_h |
2 #define __core__date_h | |
85 | 3 |
9 | 4 #include "json.h" |
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); | |
47
d8eb763e6661
information.cpp: add widgets to the list tab, and add an
Paper <mrpapersonic@gmail.com>
parents:
9
diff
changeset
|
14 bool IsValid() const; |
51 | 15 void SetYear(unsigned int y); |
16 void SetMonth(unsigned int m); | |
17 void SetDay(unsigned int d); | |
9 | 18 void VoidYear(); |
19 void VoidMonth(); | |
20 void VoidDay(); | |
51 | 21 unsigned int GetYear() const; |
22 unsigned int GetMonth() const; | |
23 unsigned int GetDay() const; | |
9 | 24 QDate GetAsQDate() const; |
25 nlohmann::json GetAsAniListJson() const; | |
26 bool operator<(const Date& other) const; | |
27 bool operator>(const Date& other) const; | |
28 bool operator<=(const Date& other) const; | |
29 bool operator>=(const Date& other) const; | |
30 | |
31 private: | |
51 | 32 /* note: it might be worth it to change these all to int, as |
33 large bit precisions aren't exactly useful here... */ | |
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 |