libzypp 17.37.10

zypp::target::rpm::librpmDb::db_const_iterator Class Reference

Subclass to retrieve rpm database content. More...

`#include <zypp/target/rpm/librpmDb.h>`

Inheritance diagram for zypp::target::rpm::librpmDb::db_const_iterator:

## Classes
class | D

## Public Member Functions
| db_const_iterator () ZYPP_DEPRECATED
| Open the default rpmdb below the host system (at /).
| db_const_iterator (const Pathname &root_r)
| Open the default rpmdb below the system at root_r.
| db_const_iterator (const Pathname &root_r, const Pathname &dbPath_r)
| Open a specific rpmdb below the system at root_r.
| db_const_iterator (std::nullptr_t)
| A null iterator.
| ~db_const_iterator ()
| Destructor.
bool | hasDB () const
| Whether an underlying rpmdb exists.
void | operator++ ()
| Advance to next RpmHeader::constPtr.
unsigned | dbHdrNum () const
| Returns the current headers index in database, 0 if no header.
const RpmHeader::constPtr & | operator* () const
| Returns the current RpmHeader::constPtr or NULL, if no more entries available.
const RpmHeader::constPtr & | operator-> () const
| Forwards to the current RpmHeader::constPtr.
bool | findAll ()
| Reset to iterate all packages.
bool | findByFile (const std::string &file_r)
| Reset to iterate all packages that own a certain file.
bool | findByProvides (const std::string &tag_r)
| Reset to iterate all packages that provide a certain tag.
bool | findByRequiredBy (const std::string &tag_r)
| Reset to iterate all packages that require a certain tag.
bool | findByConflicts (const std::string &tag_r)
| Reset to iterate all packages that conflict with a certain tag.
bool | findByName (const std::string &name_r)
| Reset to iterate all packages with a certain name.
bool | findPackage (const std::string &name_r)
| Find package by name.
bool | findPackage (const std::string &name_r, const Edition &ed_r)
| Find package by name and edition.
bool | findPackage (const Package::constPtr &which_r)
| Abbr.

## Private Member Functions
db_const_iterator & | operator= (const db_const_iterator &)
| db_const_iterator (const db_const_iterator &)

## Private Attributes
D & | _d

## Friends
class | librpmDb
std::ostream & | operator<< (std::ostream &str, const db_const_iterator &obj)

## Related Symbols
(Note that these are not member symbols.)
std::ostream & | operator<< (std::ostream &str, const librpmDb::db_const_iterator &obj) ZYPP_API
| stream output

## Detailed Description

Subclass to retrieve rpm database content.

If the specified rpm database was opened successfully, the iterator is initialized to findAll. Otherwise the iterator is an empty null iterator.

Note
  The iterator will never create a not existing database.
  The iterator keeps the rpm database open as a reader, so do not store it for longer than necessary as it may prevent write operations.

Definition at line 197 of file librpmDb.h.

## Constructor & Destructor Documentation

## ◆ db_const_iterator() [1/5]

zypp::target::rpm::librpmDb::db_const_iterator::db_const_iterator | ( | const db_const_iterator & |  | ) |
| private

## ◆ db_const_iterator() [2/5]

zypp::target::rpm::librpmDb::db_const_iterator::db_const_iterator | ( |  | ) |

Open the default rpmdb below the host system (at /).

Deprecated
  It's preferred to explicitly tell the root directory of the system whose database you want to query.

Definition at line 381 of file librpmDb.cc.

## ◆ db_const_iterator() [3/5]

zypp::target::rpm::librpmDb::db_const_iterator::db_const_iterator | ( | const Pathname & | root_r | ) |
| explicit

Open the default rpmdb below the system at root_r.

Definition at line 385 of file librpmDb.cc.

## ◆ db_const_iterator() [4/5]

zypp::target::rpm::librpmDb::db_const_iterator::db_const_iterator | ( | const Pathname & | root_r,
|  | const Pathname & | dbPath_r )

Open a specific rpmdb below the system at root_r.

Definition at line 389 of file librpmDb.cc.

## ◆ db_const_iterator() [5/5]

zypp::target::rpm::librpmDb::db_const_iterator::db_const_iterator | ( | std::nullptr_t |  | ) |

A null iterator.

What you get if the database does not exist.

Definition at line 393 of file librpmDb.cc.

## ◆ ~db_const_iterator()

zypp::target::rpm::librpmDb::db_const_iterator::~db_const_iterator | ( |  | ) |

Destructor.

Definition at line 397 of file librpmDb.cc.

## Member Function Documentation

## ◆ operator=()

db_const_iterator & zypp::target::rpm::librpmDb::db_const_iterator::operator= | ( | const db_const_iterator & |  | ) |
| private

## ◆ hasDB()

bool zypp::target::rpm::librpmDb::db_const_iterator::hasDB | ( |  | ) | const

Whether an underlying rpmdb exists.

Definition at line 400 of file librpmDb.cc.

## ◆ operator++()

void zypp::target::rpm::librpmDb::db_const_iterator::operator++ | ( |  | ) |

Advance to next RpmHeader::constPtr.

Definition at line 403 of file librpmDb.cc.

## ◆ dbHdrNum()

unsigned zypp::target::rpm::librpmDb::db_const_iterator::dbHdrNum | ( |  | ) | const

Returns the current headers index in database, 0 if no header.

Definition at line 406 of file librpmDb.cc.

## ◆ operator*()

const RpmHeader::constPtr & zypp::target::rpm::librpmDb::db_const_iterator::operator* | ( |  | ) | const

Returns the current RpmHeader::constPtr or NULL, if no more entries available.

Definition at line 409 of file librpmDb.cc.

## ◆ operator->()

const RpmHeader::constPtr & zypp::target::rpm::librpmDb::db_const_iterator::operator-> | ( |  | ) | const
| inline

Forwards to the current RpmHeader::constPtr.

Definition at line 270 of file librpmDb.h.

## ◆ findAll()

bool zypp::target::rpm::librpmDb::db_const_iterator::findAll | ( |  | ) |

Reset to iterate all packages.

Returns true if iterator contains at least one entry.

Definition at line 415 of file librpmDb.cc.

## ◆ findByFile()

bool zypp::target::rpm::librpmDb::db_const_iterator::findByFile | ( | const std::string & | file_r | ) |

Reset to iterate all packages that own a certain file.

Definition at line 418 of file librpmDb.cc.

## ◆ findByProvides()

bool zypp::target::rpm::librpmDb::db_const_iterator::findByProvides | ( | const std::string & | tag_r | ) |

Reset to iterate all packages that provide a certain tag.

Definition at line 421 of file librpmDb.cc.

## ◆ findByRequiredBy()

bool zypp::target::rpm::librpmDb::db_const_iterator::findByRequiredBy | ( | const std::string & | tag_r | ) |

Reset to iterate all packages that require a certain tag.

Definition at line 424 of file librpmDb.cc.

## ◆ findByConflicts()

bool zypp::target::rpm::librpmDb::db_const_iterator::findByConflicts | ( | const std::string & | tag_r | ) |

Reset to iterate all packages that conflict with a certain tag.

Definition at line 427 of file librpmDb.cc.

## ◆ findByName()

bool zypp::target::rpm::librpmDb::db_const_iterator::findByName | ( | const std::string & | name_r | ) |

Reset to iterate all packages with a certain name.

NOTE: Multiple entries for one package installed in different versions are possible but not desired. Usually you'll want to use findPackage instead.

findByName is needed to retrieve pseudo packages like 'gpg-pubkey', which in fact exist in multiple instances.

Definition at line 430 of file librpmDb.cc.

## ◆ findPackage() [1/3]

bool zypp::target::rpm::librpmDb::db_const_iterator::findPackage | ( | const std::string & | name_r | ) |

Find package by name.

Multiple entries for one package installed in different versions are possible but not desired. If so, the last package installed is returned.

Definition at line 433 of file librpmDb.cc.

## ◆ findPackage() [2/3]

bool zypp::target::rpm::librpmDb::db_const_iterator::findPackage | ( | const std::string & | name_r,
|  | const Edition & | ed_r )

Find package by name and edition.

Commonly used by PMRpmPackageDataProvider.

Definition at line 456 of file librpmDb.cc.

## ◆ findPackage() [3/3]

bool zypp::target::rpm::librpmDb::db_const_iterator::findPackage | ( | const Package::constPtr & | which_r | ) |

Abbr.

for `findPackage( which_r->name(), which_r->edition() );`

Definition at line 473 of file librpmDb.cc.

## Friends And Related Symbol Documentation

## ◆ librpmDb

friend class librpmDb
| friend

Definition at line 202 of file librpmDb.h.

## ◆ operator<< [1/2]

std::ostream & operator<< | ( | std::ostream & | str,
|  | const db_const_iterator & | obj )
| friend

Definition at line 412 of file librpmDb.cc.

## ◆ operator<<() [2/2]

std::ostream & operator<< | ( | std::ostream & | str,
|  | const librpmDb::db_const_iterator & | obj )
| related

stream output

Definition at line 412 of file librpmDb.cc.

## Member Data Documentation

## ◆ _d

D& zypp::target::rpm::librpmDb::db_const_iterator::_d
| private

Definition at line 210 of file librpmDb.h.

The documentation for this class was generated from the following files:

- zypp/target/rpm/librpmDb.h
- zypp/target/rpm/librpmDb.cc