Mercurial > minori
comparison src/core/date.cc @ 174:f88eda79c60a
anime/db: add some more json functionality, still doesn't compile :/
author | Paper <mrpapersonic@gmail.com> |
---|---|
date | Wed, 29 Nov 2023 13:53:56 -0500 |
parents | 9b2b41f83a5e |
children | 9b10175be389 |
comparison
equal
deleted
inserted
replaced
173:de0a8d2f28b3 | 174:f88eda79c60a |
---|---|
25 | 25 |
26 Date::Date(const QDate& date) { | 26 Date::Date(const QDate& date) { |
27 SetYear(date.year()); | 27 SetYear(date.year()); |
28 SetMonth(date.month()); | 28 SetMonth(date.month()); |
29 SetDay(date.day()); | 29 SetDay(date.day()); |
30 } | |
31 | |
32 Date::Date(const nlohmann::json& json) { | |
33 if (json.contains("year") && json.at("year").is_number()) | |
34 SetYear(json.at("year").get<unsigned int>()); | |
35 if (json.contains("month") && json.at("month").is_number()) | |
36 SetMonth(json.at("month").get<unsigned int>()); | |
37 if (json.contains("day") && json.at("day").is_number()) | |
38 SetDay(json.at("day").get<unsigned int>()); | |
30 } | 39 } |
31 | 40 |
32 void Date::VoidYear() { | 41 void Date::VoidYear() { |
33 year.reset(); | 42 year.reset(); |
34 } | 43 } |