libzypp
10.5.0
|
00001 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 4 -*- */ 00002 /* ResolverProblem.cc 00003 * 00004 * Easy-to use interface to the ZYPP dependency resolver 00005 * 00006 * Copyright (C) 2000-2002 Ximian, Inc. 00007 * Copyright (C) 2005 SUSE Linux Products GmbH 00008 * 00009 * This program is free software; you can redistribute it and/or 00010 * modify it under the terms of the GNU General Public License, 00011 * version 2, as published by the Free Software Foundation. 00012 * 00013 * This program is distributed in the hope that it will be useful, but 00014 * WITHOUT ANY WARRANTY; without even the implied warranty of 00015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00016 * General Public License for more details. 00017 * 00018 * You should have received a copy of the GNU General Public License 00019 * along with this program; if not, write to the Free Software 00020 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 00021 * 02111-1307, USA. 00022 */ 00023 00024 #include "zypp/ResolverProblem.h" 00025 #include "zypp/ProblemSolution.h" 00026 00027 using namespace std; 00028 00030 namespace zypp 00031 { 00032 00033 IMPL_PTR_TYPE(ResolverProblem); 00034 00035 //--------------------------------------------------------------------------- 00036 00037 ostream& 00038 operator<<( ostream& os, const ResolverProblem & problem) 00039 { 00040 os << "Problem:" << endl; 00041 os << problem._description << endl; 00042 os << problem._details << endl; 00043 os << problem._solutions; 00044 return os; 00045 } 00046 00047 00048 ostream& 00049 operator<<( ostream& os, const ResolverProblemList & problemlist) 00050 { 00051 for (ResolverProblemList::const_iterator iter = problemlist.begin(); iter != problemlist.end(); ++iter) { 00052 if (iter != problemlist.begin()) 00053 os << ", "; 00054 os << (*iter); 00055 } 00056 return os; 00057 } 00058 00059 //--------------------------------------------------------------------------- 00060 00064 ResolverProblem::ResolverProblem( const string & description, const string & details ) 00065 : _description (description) 00066 , _details (details) 00067 { 00068 } 00069 00073 ResolverProblem::~ResolverProblem() 00074 { 00075 } 00076 00092 ProblemSolutionList 00093 ResolverProblem::solutions() const 00094 { 00095 return _solutions; 00096 } 00097 00103 void 00104 ResolverProblem::addSolution( ProblemSolution_Ptr solution, 00105 bool inFront ) 00106 { 00107 if (inFront) { 00108 _solutions.push_front (solution); 00109 } else { 00110 _solutions.push_back (solution); 00111 } 00112 } 00113 00114 void 00115 ResolverProblem::clear() 00116 { 00117 _solutions.clear(); 00118 } 00119 00121 };// namespace zypp