2
@file cache/entity/relation.h
3
@author Peter Rockai <me@mornfall.net>
6
#include <apt-front/cache/entity/entity.h>
7
#include <apt-front/cache/component/packages.h>
12
#ifndef APTFRONT_CACHE_ENTITY_RELATION_H
13
#define APTFRONT_CACHE_ENTITY_RELATION_H
20
@brief Iterate over relations of a given package with others.
22
This is your interface to the package relationships stored within apt's
23
cache. This includes dependencies, reverse dependencies, conflicts,
24
reverse conflicts. You can get the relevant relation iterators using
25
the relevant PackageIterator accessors.
27
class Relation : public Implementation<Relation, Base> {
29
enum Type { Dependency, ReverseDependency, Conflict, ReverseConflict };
31
Relation( const Entity &i ) {
32
initFromBase( i.impl() );
35
/* Interface safety. */
36
bool valid() const { // XXX
40
/* RelationIterator functionality. */
41
bool operator==( const Relation &d ) const {
42
return d.m_cache == m_cache;
45
bool operator<( const Relation &d ) const {
50
@brief Get a sensible name of the relation.
52
This will give you a reasonably useful name of the relation's declaration.
53
It does NOT include the type! For a given package/version/type combination,
54
this should also be fairly unique. It roughly corresponds how apt-cache
55
formats the Depends: et al fields when showing package details.
57
std::string name() const { return ""; };
60
@brief Get list of possible targets for this relation.
62
This method will return you a list of all VersionIterator's that are
63
fit for satisfying this relation declaration. For depends, this means
64
list of packages that would satisfy the dependency (you need to have
65
only once of those installed to satisfy it!), for conflicts, this means
66
list of all packages conflicting with owner of this relation (you
67
need to uninstall all of those to be able to install owner!).
69
std::vector<Version> targetList() const;
71
/// Get the type of this relation.
74
/// Get the owner PackageIterator (that is, the one from which we were obtained).
75
Package ownerPackage() const;
77
/// Get the owner VersionIterator (that is the one from which we were obtained).
78
Version ownerVersion() const;
81
@brief Get a "straight" version of this RelationIterator.
83
This will return a straight (as opposed to reverse) version of this
84
very same iterator. If it was already straight, you will get a copy
85
of it. If it was reverse, the straight variant will be looked up in the
88
Relation straight() const;