Mercurial > minori
annotate 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 |
| rev | line source |
|---|---|
| 9 | 1 #ifndef __core__date_h |
| 2 #define __core__date_h | |
| 85 | 3 |
|
187
9613d72b097e
*: multiple performance improvements
Paper <mrpapersonic@gmail.com>
parents:
174
diff
changeset
|
4 #include "json/json_fwd.hpp" |
|
9613d72b097e
*: multiple performance improvements
Paper <mrpapersonic@gmail.com>
parents:
174
diff
changeset
|
5 |
|
196
f0ff06a45c42
date: use std::optional for values
Paper <mrpapersonic@gmail.com>
parents:
187
diff
changeset
|
6 #include <optional> |
|
f0ff06a45c42
date: use std::optional for values
Paper <mrpapersonic@gmail.com>
parents:
187
diff
changeset
|
7 |
|
187
9613d72b097e
*: multiple performance improvements
Paper <mrpapersonic@gmail.com>
parents:
174
diff
changeset
|
8 class QDate; |
| 85 | 9 |
| 9 | 10 class Date { |
| 258 | 11 public: |
| 12 using Year = unsigned int; | |
| 13 using Day = unsigned char; | |
| 14 enum class Month { | |
| 15 Jan = 0, | |
| 16 Feb, | |
| 17 Mar, | |
| 18 Apr, | |
| 19 May, | |
| 20 Jun, | |
| 21 Jul, | |
| 22 Aug, | |
| 23 Sep, | |
| 24 Oct, | |
| 25 Nov, | |
| 26 Dec | |
| 27 }; | |
| 9 | 28 |
| 258 | 29 Date(); |
| 30 Date(Year y); | |
| 31 Date(Year y, Month m, Day d); | |
| 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; | |
| 9 | 51 }; |
| 85 | 52 |
| 9 | 53 #endif // __core__date_h |
