summaryrefslogtreecommitdiff
path: root/src/solution_fragment.h
blob: 645d404dbd560a39b1eccc798f4be25a8cbbcf06 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
// solution_fragment.h            -*-c++-*-
//
//   Copyright (C) 2005 Daniel Burrows
//
//   This program is free software; you can redistribute it and/or
//   modify it under the terms of the GNU General Public License as
//   published by the Free Software Foundation; either version 2 of
//   the License, or (at your option) any later version.
//
//   This program is distributed in the hope that it will be useful,
//   but WITHOUT ANY WARRANTY; without even the implied warranty of
//   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
//   General Public License for more details.
//
//   You should have received a copy of the GNU General Public License
//   along with this program; see the file COPYING.  If not, write to
//   the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
//   Boston, MA 02111-1307, USA.
//
// Code to convert an aptitude resolver solution and some of its
// individual components to fragments.

#ifndef SOLUTION_FRAGMENT_H
#define SOLUTION_FRAGMENT_H

#include <apt-pkg/pkgcache.h>

// For aptitude_solution::action
#include <generic/problemresolver/solution.h>

// So passing aptitude_solution::action to a function is legal
#include <generic/apt/aptitude_resolver_universe.h>

class fragment;
class aptitude_universe;

fragment *solution_fragment(const generic_solution<aptitude_universe> &solution);

/** \return a list of the archives to which a version
 *  belongs in the form "archive1,archive2,..."
 */
std::string archives_text(const pkgCache::VerIterator &v);

/** \return a fragment describing the given action. */
fragment *action_fragment(const generic_solution<aptitude_universe>::action &a);

/** \return descriptive text about a single dependency. */
std::wstring dep_text(const pkgCache::DepIterator &d);

/** \return descriptive text about a conflict through a provides.
 *
 *  \param conflict any dependency
 *  \param p a provides iterator corresponding to conflict.  If conflict
 *           is not a Conflict, then p is ignored and conflict_text is
 *           identical to dep_text.  Otherwise, p is taken to be
 *           the provides through which the conflict was discovered.
 */
std::wstring conflict_text(const pkgCache::DepIterator &conflict,
			   const pkgCache::PrvIterator &p);

/** \return descriptive text about the targets of a dependency. */
std::string dep_targets(const pkgCache::DepIterator &start);

#endif // SOLUTION_FRAGMENT_H