s/source/source_package_publishing_history/g

main
Simon Quigley 2 months ago
parent e547684f45
commit fc95337bb7

@ -19,7 +19,7 @@ add_library(launchpad SHARED
src/person.cpp src/person.cpp
src/distribution.cpp src/distribution.cpp
src/authentication.cpp src/authentication.cpp
src/source.cpp src/source_package_publishing_history.cpp
src/build.cpp src/build.cpp
) )
@ -32,7 +32,7 @@ target_compile_definitions(launchpad PRIVATE BUILDING_LAUNCHPAD)
set_target_properties(launchpad PROPERTIES set_target_properties(launchpad PROPERTIES
VERSION ${PROJECT_VERSION} VERSION ${PROJECT_VERSION}
SOVERSION 0 SOVERSION 0
PUBLIC_HEADER "src/launchpad.h;src/callablewrapper.h;src/archive.h;src/utils.h;src/person.h;src/distribution.h;src/authentication.h;src/source.h;src/build.h" PUBLIC_HEADER "src/launchpad.h;src/callablewrapper.h;src/archive.h;src/utils.h;src/person.h;src/distribution.h;src/authentication.h;src/source_package_publishing_history.h;src/build.h"
CXX_VISIBILITY_PRESET hidden CXX_VISIBILITY_PRESET hidden
VISIBILITY_INLINES_HIDDEN YES VISIBILITY_INLINES_HIDDEN YES
) )

@ -16,7 +16,7 @@
#include "archive.h" #include "archive.h"
#include "utils.h" #include "utils.h"
#include "launchpad.h" #include "launchpad.h"
#include "source.h" #include "source_package_publishing_history.h"
#include <iostream> #include <iostream>
#include <nlohmann/json.hpp> #include <nlohmann/json.hpp>
@ -131,7 +131,7 @@ std::string archive::build_archive_endpoint() const {
return "~" + url_encode(owner_name) + "/" + url_encode(ppa_name); return "~" + url_encode(owner_name) + "/" + url_encode(ppa_name);
} }
std::generator<source> archive::getPublishedSources(const std::string& status) const { std::generator<source_package_publishing_history> archive::getPublishedSources(const std::string& status) const {
std::map<std::string, std::string> params; std::map<std::string, std::string> params;
params["ws.op"] = "getPublishedSources"; params["ws.op"] = "getPublishedSources";
params["status"] = status; params["status"] = status;
@ -142,7 +142,7 @@ std::generator<source> archive::getPublishedSources(const std::string& status) c
try { try {
if (data.contains("entries") && data["entries"].is_array()) { if (data.contains("entries") && data["entries"].is_array()) {
for (auto& entry : data["entries"]) { for (auto& entry : data["entries"]) {
std::optional<source> s_opt = source::parse(entry.dump()); auto s_opt = source_package_publishing_history::parse(entry.dump());
if (!s_opt) continue; if (!s_opt) continue;
s_opt->set_lp(lp); s_opt->set_lp(lp);
co_yield s_opt.value(); co_yield s_opt.value();

@ -16,7 +16,7 @@
#ifndef ARCHIVE_H #ifndef ARCHIVE_H
#define ARCHIVE_H #define ARCHIVE_H
#include "source.h" #include "source_package_publishing_history.h"
#include <generator> #include <generator>
#include <nlohmann/json.hpp> #include <nlohmann/json.hpp>
#include <optional> #include <optional>
@ -77,7 +77,7 @@ public:
std::string web_link; std::string web_link;
// Public functions // Public functions
std::generator<source> getPublishedSources(const std::string& status) const; std::generator<source_package_publishing_history> getPublishedSources(const std::string& status) const;
launchpad* lp; launchpad* lp;

@ -27,7 +27,7 @@
class distribution; class distribution;
class person; class person;
class archive; class archive;
class source; class source_package_publishing_history;
class build; class build;
#ifndef LAUNCHPAD_API #ifndef LAUNCHPAD_API
@ -95,11 +95,11 @@ private:
std::optional<distribution> get_distribution(const std::string& name_); std::optional<distribution> get_distribution(const std::string& name_);
std::optional<person> get_person(const std::string& name_); std::optional<person> get_person(const std::string& name_);
friend class person; // so person can call api_* friend class person; // so person can call api_*
friend class distribution; // so distribution can call api_* friend class distribution; // so distribution can call api_*
friend class archive; // so archive can call api_* friend class archive; // so archive can call api_*
friend class source; // so source can call api_* friend class source_package_publishing_history; // so source can call api_*
friend class build; // so build can call api_* friend class build; // so build can call api_*
}; };
#endif // LAUNCHPAD_H #endif // LAUNCHPAD_H

@ -13,25 +13,25 @@
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>. // along with this program. If not, see <https://www.gnu.org/licenses/>.
#include "source.h" #include "source_package_publishing_history.h"
#include "utils.h" #include "utils.h"
#include "build.h" #include "build.h"
#include "launchpad.h" #include "launchpad.h"
#include <iostream> #include <iostream>
#include <nlohmann/json.hpp> #include <nlohmann/json.hpp>
source::source() source_package_publishing_history::source_package_publishing_history()
: source_package_name(""), source_package_version(""), self_link(""), lp(nullptr) {} : source_package_name(""), source_package_version(""), self_link(""), lp(nullptr) {}
source::~source() {} source_package_publishing_history::~source_package_publishing_history() {}
std::optional<source> source::parse(const std::string& json_data) { std::optional<source_package_publishing_history> source_package_publishing_history::parse(const std::string& json_data) {
source s; source_package_publishing_history s;
s.parse_json(json_data); s.parse_json(json_data);
return s; return s;
} }
void source::parse_json(const std::string& json_data) { void source_package_publishing_history::parse_json(const std::string& json_data) {
try { try {
auto data = nlohmann::json::parse(json_data); auto data = nlohmann::json::parse(json_data);
@ -51,7 +51,7 @@ void source::parse_json(const std::string& json_data) {
} }
} }
std::vector<build> source::getBuilds() const { std::vector<build> source_package_publishing_history::getBuilds() const {
std::vector<build> builds; std::vector<build> builds;
if (self_link.empty()) { return builds; } if (self_link.empty()) { return builds; }
@ -76,6 +76,6 @@ std::vector<build> source::getBuilds() const {
return builds; return builds;
} }
void source::set_lp(launchpad* lp_ptr) { void source_package_publishing_history::set_lp(launchpad* lp_ptr) {
lp = lp_ptr; lp = lp_ptr;
} }

@ -13,8 +13,8 @@
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>. // along with this program. If not, see <https://www.gnu.org/licenses/>.
#ifndef SOURCE_H #ifndef SOURCE_PACKAGE_PUBLISHING_HISTORY
#define SOURCE_H #define SOURCE_PACKAGE_PUBLISHING_HISTORY
#include <string> #include <string>
#include <optional> #include <optional>
@ -31,13 +31,13 @@ class launchpad;
#endif #endif
#endif #endif
class LAUNCHPAD_API source { class LAUNCHPAD_API source_package_publishing_history {
public: public:
source(); source_package_publishing_history();
~source(); ~source_package_publishing_history();
// Add static parse method declaration // Add static parse method declaration
static std::optional<source> parse(const std::string& json_data); static std::optional<source_package_publishing_history> parse(const std::string& json_data);
void parse_json(const std::string& json_data); void parse_json(const std::string& json_data);
std::vector<build> getBuilds() const; std::vector<build> getBuilds() const;
@ -52,4 +52,4 @@ private:
launchpad* lp; launchpad* lp;
}; };
#endif // SOURCE_H #endif // SOURCE_PACKAGE_PUBLISHING_HISTORY
Loading…
Cancel
Save