Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

advisory: Add missing methods to AdvisoryPackage #731

Merged
merged 1 commit into from
Jul 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions include/libdnf5/advisory/advisory_package.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,21 @@ class AdvisoryPackage {
/// @return Name of this AdvisoryPackage as std::string.
std::string get_name() const;

/// Get epoch of this AdvisoryPackage.
///
/// @return Epoch of this AdvisoryPackage as std::string.
std::string get_epoch() const;

/// Get version of this AdvisoryPackage.
///
/// @return Version of this AdvisoryPackage as std::string.
std::string get_version() const;

/// Get release version of this AdvisoryPackage.
///
/// @return Release of this AdvisoryPackage as std::string.
std::string get_release() const;

/// Get evr of this AdvisoryPackage.
///
/// @return Evr of this AdvisoryPackage as std::string.
Expand Down
18 changes: 18 additions & 0 deletions libdnf5/advisory/advisory_package.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,18 @@ std::string AdvisoryPackage::get_name() const {
return p_impl->get_name();
}

std::string AdvisoryPackage::get_epoch() const {
return p_impl->get_epoch();
}

std::string AdvisoryPackage::get_version() const {
return p_impl->get_version();
}

std::string AdvisoryPackage::get_release() const {
return p_impl->get_release();
}

std::string AdvisoryPackage::get_evr() const {
return p_impl->get_evr();
}
Expand Down Expand Up @@ -102,11 +110,21 @@ std::string AdvisoryPackage::Impl::get_name() const {
return get_rpm_pool(base).id2str(name);
}

std::string AdvisoryPackage::Impl::get_epoch() const {
auto & pool = get_rpm_pool(base);
return pool.split_evr(pool.id2str(evr)).e_def();
}

std::string AdvisoryPackage::Impl::get_version() const {
auto & pool = get_rpm_pool(base);
return pool.split_evr(pool.id2str(evr)).v;
}

std::string AdvisoryPackage::Impl::get_release() const {
auto & pool = get_rpm_pool(base);
return pool.split_evr(pool.id2str(evr)).r;
}

std::string AdvisoryPackage::Impl::get_evr() const {
return get_rpm_pool(base).id2str(evr);
}
Expand Down
2 changes: 2 additions & 0 deletions libdnf5/advisory/advisory_package_private.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@ namespace libdnf5::advisory {
class AdvisoryPackage::Impl {
public:
std::string get_name() const;
std::string get_epoch() const;
std::string get_version() const;
std::string get_release() const;
std::string get_evr() const;
std::string get_arch() const;
Id get_name_id() const { return name; };
Expand Down
Loading