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

Add pImpl to libdnf5::repo::* #1272

Merged
merged 2 commits into from
Mar 6, 2024

Conversation

kontura
Copy link
Contributor

@kontura kontura commented Feb 26, 2024

This PR is into a new dnf5-5.2.0.0 branch to keep the main branch ABI compatible.

For: #1025

I am leaving the interface classes RepoCallbacks and DownloadCallbacks unmodified.

RepoQuery::RepoQuery(const RepoQuery & src) : libdnf5::sack::Query<RepoWeakPtr>(src), p_impl(new Impl(*src.p_impl)) {}
RepoQuery::RepoQuery(RepoQuery && src) noexcept = default;

RepoQuery & RepoQuery::operator=(const RepoQuery & src) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a reason to write the same code over and over again?

If instead of std::unique_ptr<Impl> p_impl; we use ImplPtr<Impl> p_impl; (#include "libdnf5/common/impl_ptr.hpp), then we don't have to re-implement copy/move constructor/assignment every time.

Then we can use the default implementation for everything::

RepoQuery::RepoQuery(const RepoQuery & src) = default;
RepoQuery::RepoQuery(RepoQuery && src) noexcept = default;
RepoQuery & RepoQuery::operator=(const RepoQuery & src) = default;
RepoQuery & RepoQuery::operator=(RepoQuery && src) noexcept = default;

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, I wish I had realized that. I have added it basically everywhere. 🤦‍♂️

Update in this PR.

@jrohel
Copy link
Contributor

jrohel commented Mar 6, 2024

@kontura Thanks for the PR update.

@jrohel jrohel merged commit 612b8ad into rpm-software-management:dnf5-5.2.0.0 Mar 6, 2024
7 of 22 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants