Skip to content

Commit

Permalink
Add/fix documentation for rpm::PackageQuery methods
Browse files Browse the repository at this point in the history
  • Loading branch information
jrohel committed May 9, 2024
1 parent 4b62aef commit 6c14ba4
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 3 deletions.
30 changes: 28 additions & 2 deletions include/libdnf5/rpm/package_query.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,7 @@ class PackageQuery : public PackageSet {
void filter_summary(
const std::vector<std::string> & patterns, libdnf5::sack::QueryCmp cmp_type = libdnf5::sack::QueryCmp::EQ);

/// Filter packages by their `summary`.
/// Filter packages by their `description`.
///
/// @param pattern A string the filter is matched against.
/// @param cmp_type A comparison (match) operator, defaults to `QueryCmp::EQ`.
Expand All @@ -373,7 +373,7 @@ class PackageQuery : public PackageSet {
filter_description(std::vector<std::string>{pattern}, cmp_type);
};

/// Filter packages by their `summary`.
/// Filter packages by their `description`.
///
/// @param patterns A vector of strings the filter is matched against.
/// @param cmp_type A comparison (match) operator, defaults to `QueryCmp::EQ`.
Expand Down Expand Up @@ -847,19 +847,45 @@ class PackageQuery : public PackageSet {
PackageQuery & installed,
libdnf5::sack::QueryCmp cmp_type = libdnf5::sack::QueryCmp::GTE);

/// Filter installed packages.
///
/// Removes from the query all packages that are not installed.
/// @since 5.0
// @replaces libdnf/sack/query.hpp:method:installed()
void filter_installed();

/// Filter available packages.
///
/// Removes from the query all packages that are installed.
/// @since 5.0
// @replaces libdnf/sack/query.hpp:method:available()
void filter_available();

/// Filter available packages that are upgrades to installed packages.
///
/// Removes from the query all packages that are not upgrades to installed packages.
/// @since 5.0
// @replaces libdnf/sack/query.hpp:method:addFilter(int keyname, int cmp_type, int match) - cmp_type = HY_PKG_UPGRADES
void filter_upgrades();

/// Filter available packages that are downgrades to installed packages.
///
/// Removes from the query all packages that are not downgrades to installed packages.
/// @since 5.0
// @replaces libdnf/sack/query.hpp:method:addFilter(int keyname, int cmp_type, int match) - cmp_type = HY_PKG_DOWNGRADES
void filter_downgrades();

/// Filter installed packages for which there are available upgrades.
///
/// Only installed packages remain in the query, and only those for which upgrades are available.
/// @since 5.0
// @replaces libdnf/sack/query.hpp:method:addFilter(int keyname, int cmp_type, int match) - cmp_type = HY_PKG_UPGRADABLE
void filter_upgradable();

/// Filter installed packages for which there are available downgrades.
///
/// Only installed packages remain in the query, and only those for which downgrades are available.
/// @since 5.0
// @replaces libdnf/sack/query.hpp:method:addFilter(int keyname, int cmp_type, int match) - cmp_type = HY_PKG_DOWNGRADABLE
void filter_downgradable();

Expand Down
2 changes: 1 addition & 1 deletion libdnf5/rpm/package_query.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ Id what_upgrades(libdnf5::solv::RpmPool & spool, const Solvable * solvable) {
return l;
}

/// Return id of a package that can be upgraded with pkg.
/// Return id of a package that can be downgraded with pkg.
///
/// The returned package Id fulfills the following criteria:
/// :: it is installed
Expand Down

0 comments on commit 6c14ba4

Please sign in to comment.