From 956c46e9e99678c4c09c5d02d716a5cc276bf2ab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ale=C5=A1=20Mat=C4=9Bj?= Date: Tue, 22 Oct 2024 12:41:41 +0200 Subject: [PATCH] Add `get_base()` to `libdnf::transaction::Transaction` --- include/libdnf5/transaction/transaction.hpp | 3 +++ libdnf5/transaction/transaction.cpp | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/include/libdnf5/transaction/transaction.hpp b/include/libdnf5/transaction/transaction.hpp index 22525656c..fd90a28f2 100644 --- a/include/libdnf5/transaction/transaction.hpp +++ b/include/libdnf5/transaction/transaction.hpp @@ -165,6 +165,9 @@ class LIBDNF_API Transaction { /// into a `libdnf5::Goal` and replayed. std::string serialize(); + /// @return A `Base` object to which the transaction belongs. + BaseWeakPtr get_base() const; + private: friend Transformer; friend libdnf5::base::Transaction; diff --git a/libdnf5/transaction/transaction.cpp b/libdnf5/transaction/transaction.cpp index 43917cbd1..a507dce9b 100644 --- a/libdnf5/transaction/transaction.cpp +++ b/libdnf5/transaction/transaction.cpp @@ -362,6 +362,10 @@ TransactionState Transaction::get_state() const noexcept { return p_impl->state; } +BaseWeakPtr Transaction::get_base() const { + return p_impl->base; +} + // Setters void Transaction::set_id(int64_t value) {