Try some more direct type fun

main
Simon Quigley 4 days ago
parent 61d95127b6
commit 0851fbeebc

@ -17,6 +17,7 @@
#include "binary_package_publishing_history.h" #include "binary_package_publishing_history.h"
#include "build.h" #include "build.h"
#include "launchpad.h" #include "launchpad.h"
#include "distro_series.h"
#include <iostream> #include <iostream>
#include <nlohmann/json.hpp> #include <nlohmann/json.hpp>
@ -26,7 +27,7 @@ source_package_publishing_history::source_package_publishing_history()
self_link(""), self_link(""),
distro_series_link(""), distro_series_link(""),
lp(nullptr), lp(nullptr),
distro_series([this]() -> std::optional<class distro_series> { distro_series([this]() -> std::optional<::distro_series> {
if (distro_series_link.empty()) return std::nullopt; if (distro_series_link.empty()) return std::nullopt;
if (_distro_series) return _distro_series; if (_distro_series) return _distro_series;
@ -34,7 +35,7 @@ source_package_publishing_history::source_package_publishing_history()
if (!response) return std::nullopt; if (!response) return std::nullopt;
auto data = nlohmann::json::parse(response.value()); auto data = nlohmann::json::parse(response.value());
auto ds = distro_series::parse(data.dump()); auto ds = ::distro_series::parse(data.dump());
if (ds) { if (ds) {
ds->set_lp(lp); ds->set_lp(lp);

@ -43,7 +43,7 @@ public:
void parse_json(const std::string& json_data); void parse_json(const std::string& json_data);
std::generator<build> getBuilds() const; std::generator<build> getBuilds() const;
lazy_optional<class distro_series, std::function<std::optional<class distro_series>()>> distro_series; lazy_optional<::distro_series, std::function<std::optional<::distro_series>()>> distro_series;
std::generator<binary_package_publishing_history> getPublishedBinaries(bool active_binaries_only = false) const; std::generator<binary_package_publishing_history> getPublishedBinaries(bool active_binaries_only = false) const;
bool requestDeletion(const std::string& removal_comment = ""); bool requestDeletion(const std::string& removal_comment = "");
@ -58,7 +58,7 @@ public:
private: private:
launchpad* lp; launchpad* lp;
std::optional<class distro_series> _distro_series = std::nullopt; std::optional<::distro_series> _distro_series = std::nullopt;
}; };
#endif // SOURCE_PACKAGE_PUBLISHING_HISTORY #endif // SOURCE_PACKAGE_PUBLISHING_HISTORY

Loading…
Cancel
Save