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/distribution.cpp
src/authentication.cpp
src/source.cpp
src/source_package_publishing_history.cpp
src/build.cpp
)
@ -32,7 +32,7 @@ target_compile_definitions(launchpad PRIVATE BUILDING_LAUNCHPAD)
set_target_properties(launchpad PROPERTIES
VERSION ${PROJECT_VERSION}
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
VISIBILITY_INLINES_HIDDEN YES
)

@ -16,7 +16,7 @@
#include "archive.h"
#include "utils.h"
#include "launchpad.h"
#include "source.h"
#include "source_package_publishing_history.h"
#include <iostream>
#include <nlohmann/json.hpp>
@ -131,7 +131,7 @@ std::string archive::build_archive_endpoint() const {
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;
params["ws.op"] = "getPublishedSources";
params["status"] = status;
@ -142,7 +142,7 @@ std::generator<source> archive::getPublishedSources(const std::string& status) c
try {
if (data.contains("entries") && data["entries"].is_array()) {
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;
s_opt->set_lp(lp);
co_yield s_opt.value();

@ -16,7 +16,7 @@
#ifndef ARCHIVE_H
#define ARCHIVE_H
#include "source.h"
#include "source_package_publishing_history.h"
#include <generator>
#include <nlohmann/json.hpp>
#include <optional>
@ -77,7 +77,7 @@ public:
std::string web_link;
// 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;

@ -27,7 +27,7 @@
class distribution;
class person;
class archive;
class source;
class source_package_publishing_history;
class build;
#ifndef LAUNCHPAD_API
@ -98,7 +98,7 @@ private:
friend class person; // so person can call api_*
friend class distribution; // so distribution 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_*
};

@ -13,25 +13,25 @@
// You should have received a copy of the GNU General Public License
// 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 "build.h"
#include "launchpad.h"
#include <iostream>
#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::~source() {}
source_package_publishing_history::~source_package_publishing_history() {}
std::optional<source> source::parse(const std::string& json_data) {
source s;
std::optional<source_package_publishing_history> source_package_publishing_history::parse(const std::string& json_data) {
source_package_publishing_history s;
s.parse_json(json_data);
return s;
}
void source::parse_json(const std::string& json_data) {
void source_package_publishing_history::parse_json(const std::string& json_data) {
try {
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;
if (self_link.empty()) { return builds; }
@ -76,6 +76,6 @@ std::vector<build> source::getBuilds() const {
return builds;
}
void source::set_lp(launchpad* lp_ptr) {
void source_package_publishing_history::set_lp(launchpad* lp_ptr) {
lp = lp_ptr;
}

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