|
|
|
@ -64,7 +64,51 @@ void build::parse_json(const std::string& json_data) {
|
|
|
|
|
{"changesfile_url", [this](const nlohmann::json& val) { changesfile_url = val.get<std::string>(); }},
|
|
|
|
|
{"buildinfo_url", [this](const nlohmann::json& val) { buildinfo_url = val.get<std::string>(); }},
|
|
|
|
|
{"external_dependencies", [this](const nlohmann::json& val) { external_dependencies = val.get<std::string>(); }},
|
|
|
|
|
{"pocket", [this](const nlohmann::json& val) { pocket = val.get<std::string>(); }}
|
|
|
|
|
{"pocket", [this](const nlohmann::json& val) { pocket = val.get<std::string>(); }},
|
|
|
|
|
{"date_first_dispatched", [this](const nlohmann::json& val) {
|
|
|
|
|
std::string datetimeStr = val.get<std::string>();
|
|
|
|
|
std::istringstream ss(datetimeStr);
|
|
|
|
|
std::tm tm = {};
|
|
|
|
|
ss >> std::get_time(&tm, "%Y-%m-%d %H:%M:%S.%f%z");
|
|
|
|
|
if (ss.fail()) {
|
|
|
|
|
std::cout << val << std::endl;
|
|
|
|
|
throw std::runtime_error("Failed to parse date_first_dispatched");
|
|
|
|
|
}
|
|
|
|
|
date_first_dispatched = std::chrono::system_clock::from_time_t(std::mktime(&tm));
|
|
|
|
|
}},
|
|
|
|
|
{"date_started", [this](const nlohmann::json& val) {
|
|
|
|
|
std::string datetimeStr = val.get<std::string>();
|
|
|
|
|
std::istringstream ss(datetimeStr);
|
|
|
|
|
std::tm tm = {};
|
|
|
|
|
ss >> std::get_time(&tm, "%Y-%m-%d %H:%M:%S.%f%z");
|
|
|
|
|
if (ss.fail()) {
|
|
|
|
|
std::cout << val << std::endl;
|
|
|
|
|
throw std::runtime_error("Failed to parse date_started");
|
|
|
|
|
}
|
|
|
|
|
date_started = std::chrono::system_clock::from_time_t(std::mktime(&tm));
|
|
|
|
|
}},
|
|
|
|
|
{"datebuilt", [this](const nlohmann::json& val) {
|
|
|
|
|
std::string datetimeStr = val.get<std::string>();
|
|
|
|
|
std::istringstream ss(datetimeStr);
|
|
|
|
|
std::tm tm = {};
|
|
|
|
|
ss >> std::get_time(&tm, "%Y-%m-%d %H:%M:%S.%f%z");
|
|
|
|
|
if (ss.fail()) {
|
|
|
|
|
std::cout << val << std::endl;
|
|
|
|
|
throw std::runtime_error("Failed to parse datebuilt");
|
|
|
|
|
}
|
|
|
|
|
datebuilt = std::chrono::system_clock::from_time_t(std::mktime(&tm));
|
|
|
|
|
}},
|
|
|
|
|
{"datecreated", [this](const nlohmann::json& val) {
|
|
|
|
|
std::string datetimeStr = val.get<std::string>();
|
|
|
|
|
std::istringstream ss(datetimeStr);
|
|
|
|
|
std::tm tm = {};
|
|
|
|
|
ss >> std::get_time(&tm, "%Y-%m-%d %H:%M:%S.%f%z");
|
|
|
|
|
if (ss.fail()) {
|
|
|
|
|
std::cout << val << std::endl;
|
|
|
|
|
throw std::runtime_error("Failed to parse datecreated");
|
|
|
|
|
}
|
|
|
|
|
datecreated = std::chrono::system_clock::from_time_t(std::mktime(&tm));
|
|
|
|
|
}}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// Process JSON keys
|
|
|
|
|