libzypp  13.10.6
ResolverProblem.cc
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 4 -*- */
2 /* ResolverProblem.cc
3  *
4  * Easy-to use interface to the ZYPP dependency resolver
5  *
6  * Copyright (C) 2000-2002 Ximian, Inc.
7  * Copyright (C) 2005 SUSE Linux Products GmbH
8  *
9  * This program is free software; you can redistribute it and/or
10  * modify it under the terms of the GNU General Public License,
11  * version 2, as published by the Free Software Foundation.
12  *
13  * This program is distributed in the hope that it will be useful, but
14  * WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16  * General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program; if not, write to the Free Software
20  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
21  * 02111-1307, USA.
22  */
23 
24 #include "zypp/ResolverProblem.h"
25 #include "zypp/ProblemSolution.h"
26 
27 using namespace std;
28 
30 namespace zypp
31 {
32 
33 IMPL_PTR_TYPE(ResolverProblem);
34 
35 //---------------------------------------------------------------------------
36 
37 ostream&
38 operator<<( ostream& os, const ResolverProblem & problem)
39 {
40  os << "Problem:" << endl;
41  os << "==============================" << endl;
42  os << problem._description << endl;
43  os << problem._details << endl;
44  os << "------------------------------" << endl;
45  os << problem._solutions;
46  os << "==============================" << endl;
47  return os;
48 }
49 
50 
51 ostream&
52 operator<<( ostream& os, const ResolverProblemList & problemlist)
53 {
54  for (ResolverProblemList::const_iterator iter = problemlist.begin(); iter != problemlist.end(); ++iter) {
55  if (iter != problemlist.begin())
56  os << ", ";
57  os << (*iter);
58  }
59  return os;
60 }
61 
62 //---------------------------------------------------------------------------
63 
67 ResolverProblem::ResolverProblem( const string & description, const string & details )
68  : _description (description)
69  , _details (details)
70 {
71 }
72 
77 {
78 }
79 
97 {
98  return _solutions;
99 }
100 
106 void
107 ResolverProblem::addSolution( ProblemSolution_Ptr solution,
108  bool inFront )
109 {
110  if (inFront) {
111  _solutions.push_front (solution);
112  } else {
113  _solutions.push_back (solution);
114  }
115 }
116 
117 void
119 {
120  _solutions.clear();
121 }
122 
124 };// namespace zypp
ProblemSolutionList _solutions
std::list< ProblemSolution_Ptr > ProblemSolutionList
Definition: ProblemTypes.h:42
void addSolution(ProblemSolution_Ptr solution, bool inFront=false)
Add a solution to this problem.
~ResolverProblem()
Destructor.
void clear()
Clear all data.
std::list< ResolverProblem_Ptr > ResolverProblemList
Definition: ProblemTypes.h:46
std::ostream & operator<<(std::ostream &str, const ::_Dataiterator *obj)
Definition: LookupAttr.cc:799
#define IMPL_PTR_TYPE(NAME)
ProblemSolutionList solutions() const
Return the possible solutions to this problem.