Mercurial > minori
comparison include/core/date.h @ 258:862d0d8619f6
*: HUUUGE changes
animia has been renamed to animone, so instead of thinking of a
health condition, you think of a beautiful flower :)
I've also edited some of the code for animone, but I have no idea
if it even works or not because I don't have a mac or windows
machine lying around. whoops!
... anyway, all of the changes divergent from Anisthesia are now
licensed under BSD. it's possible that I could even rewrite most
of the code to where I don't even have to keep the MIT license,
but that's thinking too far into the future
I've been slacking off on implementing the anime seasons page,
mostly out of laziness. I think I'd have to create another db file
specifically for the seasons
anyway, this code is being pushed *primarily* because the hard drive
it's on is failing! yay :)
author | Paper <paper@paper.us.eu.org> |
---|---|
date | Mon, 01 Apr 2024 02:43:44 -0400 |
parents | c4ca035c565d |
children | 3ec7804abf17 |
comparison
equal
deleted
inserted
replaced
257:699a20c57dc8 | 258:862d0d8619f6 |
---|---|
6 #include <optional> | 6 #include <optional> |
7 | 7 |
8 class QDate; | 8 class QDate; |
9 | 9 |
10 class Date { | 10 class Date { |
11 public: | 11 public: |
12 Date(); | 12 using Year = unsigned int; |
13 Date(unsigned int y); | 13 using Day = unsigned char; |
14 Date(unsigned int y, unsigned int m, unsigned int d); | 14 enum class Month { |
15 Date(const QDate& date); | 15 Jan = 0, |
16 Date(const nlohmann::json& json); | 16 Feb, |
17 bool IsValid() const; | 17 Mar, |
18 void SetYear(unsigned int y); | 18 Apr, |
19 void SetMonth(unsigned int m); | 19 May, |
20 void SetDay(unsigned int d); | 20 Jun, |
21 void VoidYear(); | 21 Jul, |
22 void VoidMonth(); | 22 Aug, |
23 void VoidDay(); | 23 Sep, |
24 std::optional<unsigned int> GetYear() const; | 24 Oct, |
25 std::optional<unsigned int> GetMonth() const; | 25 Nov, |
26 std::optional<unsigned int> GetDay() const; | 26 Dec |
27 QDate GetAsQDate() const; | 27 }; |
28 nlohmann::json GetAsAniListJson() const; | |
29 | 28 |
30 private: | 29 Date(); |
31 std::optional<unsigned int> year; | 30 Date(Year y); |
32 std::optional<unsigned int> month; | 31 Date(Year y, Month m, Day d); |
33 std::optional<unsigned int> day; | 32 Date(const QDate& date); |
33 Date(const nlohmann::json& json); | |
34 bool IsValid() const; | |
35 void SetYear(Year y); | |
36 void SetMonth(Month m); | |
37 void SetDay(Day d); | |
38 void VoidYear(); | |
39 void VoidMonth(); | |
40 void VoidDay(); | |
41 std::optional<Year> GetYear() const; | |
42 std::optional<Month> GetMonth() const; | |
43 std::optional<Day> GetDay() const; | |
44 QDate GetAsQDate() const; | |
45 nlohmann::json GetAsAniListJson() const; | |
46 | |
47 private: | |
48 std::optional<Year> year; | |
49 std::optional<Month> month; | |
50 std::optional<Day> day; | |
34 }; | 51 }; |
35 | 52 |
36 #endif // __core__date_h | 53 #endif // __core__date_h |