annotate include/core/date.h @ 198:bc1ae1810855

dep/animia: switch from using classes to global functions the old idea was ok, but sort of hackish; this method doesn't use classes at all, and this way (especially important!) we can do wayland stuff AND x11 at the same time, which wasn't really possible without stupid workarounds in the other method
author Paper <mrpapersonic@gmail.com>
date Sun, 24 Dec 2023 02:59:42 -0500
parents c4ca035c565d
children 862d0d8619f6
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
9
5c0397762b53 INCOMPLETE: megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
1 #ifndef __core__date_h
5c0397762b53 INCOMPLETE: megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
2 #define __core__date_h
85
c69230dc2b5d *: cleanup includes
Paper <mrpapersonic@gmail.com>
parents: 51
diff changeset
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
c69230dc2b5d *: cleanup includes
Paper <mrpapersonic@gmail.com>
parents: 51
diff changeset
9
9
5c0397762b53 INCOMPLETE: megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
10 class Date {
5c0397762b53 INCOMPLETE: megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
11 public:
5c0397762b53 INCOMPLETE: megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
12 Date();
51
75c804f713b2 window: add about window,
Paper <mrpapersonic@gmail.com>
parents: 47
diff changeset
13 Date(unsigned int y);
75c804f713b2 window: add about window,
Paper <mrpapersonic@gmail.com>
parents: 47
diff changeset
14 Date(unsigned int y, unsigned int m, unsigned int d);
75c804f713b2 window: add about window,
Paper <mrpapersonic@gmail.com>
parents: 47
diff changeset
15 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
16 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
17 bool IsValid() const;
51
75c804f713b2 window: add about window,
Paper <mrpapersonic@gmail.com>
parents: 47
diff changeset
18 void SetYear(unsigned int y);
75c804f713b2 window: add about window,
Paper <mrpapersonic@gmail.com>
parents: 47
diff changeset
19 void SetMonth(unsigned int m);
75c804f713b2 window: add about window,
Paper <mrpapersonic@gmail.com>
parents: 47
diff changeset
20 void SetDay(unsigned int d);
9
5c0397762b53 INCOMPLETE: megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
21 void VoidYear();
5c0397762b53 INCOMPLETE: megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
22 void VoidMonth();
5c0397762b53 INCOMPLETE: megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
23 void VoidDay();
197
c4ca035c565d *: misc. patches
Paper <mrpapersonic@gmail.com>
parents: 196
diff changeset
24 std::optional<unsigned int> GetYear() const;
c4ca035c565d *: misc. patches
Paper <mrpapersonic@gmail.com>
parents: 196
diff changeset
25 std::optional<unsigned int> GetMonth() const;
c4ca035c565d *: misc. patches
Paper <mrpapersonic@gmail.com>
parents: 196
diff changeset
26 std::optional<unsigned int> GetDay() const;
9
5c0397762b53 INCOMPLETE: megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
27 QDate GetAsQDate() const;
5c0397762b53 INCOMPLETE: megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
28 nlohmann::json GetAsAniListJson() const;
5c0397762b53 INCOMPLETE: megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
29
5c0397762b53 INCOMPLETE: megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
30 private:
196
f0ff06a45c42 date: use std::optional for values
Paper <mrpapersonic@gmail.com>
parents: 187
diff changeset
31 std::optional<unsigned int> year;
f0ff06a45c42 date: use std::optional for values
Paper <mrpapersonic@gmail.com>
parents: 187
diff changeset
32 std::optional<unsigned int> month;
f0ff06a45c42 date: use std::optional for values
Paper <mrpapersonic@gmail.com>
parents: 187
diff changeset
33 std::optional<unsigned int> day;
9
5c0397762b53 INCOMPLETE: megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
34 };
85
c69230dc2b5d *: cleanup includes
Paper <mrpapersonic@gmail.com>
parents: 51
diff changeset
35
9
5c0397762b53 INCOMPLETE: megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
36 #endif // __core__date_h