2 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 4 -*- */
5 * Easy-to use interface to the ZYPP dependency resolver
7 * Copyright (C) 2000-2002 Ximian, Inc.
8 * Copyright (C) 2005 SUSE Linux Products GmbH
10 * This program is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU General Public License,
12 * version 2, as published by the Free Software Foundation.
14 * This program is distributed in the hope that it will be useful, but
15 * WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
24 #include "zypp/solver/detail/Types.h"
25 #include "zypp/solver/detail/SolutionAction.h"
26 #include "zypp/ProblemSolution.h"
27 #include "zypp/base/Logger.h"
28 #include "zypp/solver/detail/Resolver.h"
32 /////////////////////////////////////////////////////////////////////////
34 { ///////////////////////////////////////////////////////////////////////
36 IMPL_PTR_TYPE(ProblemSolution);
38 //---------------------------------------------------------------------------
41 operator<<( ostream& os, const ProblemSolution & solution)
43 os << "Solution:" << endl;
44 os << solution._description << endl;
45 if ( ! solution._details.empty() )
46 os << solution._details << endl;
47 os << solution._actions;
52 operator<<( ostream& os, const ProblemSolutionList & solutionlist)
54 for (ProblemSolutionList::const_iterator iter = solutionlist.begin(); iter != solutionlist.end(); ++iter) {
61 operator<<( ostream& os, const CProblemSolutionList & solutionlist)
63 for (CProblemSolutionList::const_iterator iter = solutionlist.begin(); iter != solutionlist.end(); ++iter) {
64 os << *(*iter) << endl;
69 //---------------------------------------------------------------------------
71 ProblemSolution::ProblemSolution( ResolverProblem_Ptr parent, const string & description, const string & details )
73 , _description (description)
79 ProblemSolution::~ProblemSolution()
85 * Apply this solution, i.e. execute all of its actions.
87 * Returns 'true' on success, 'false' if actions could not be performed.
91 ProblemSolution::apply (solver::detail::Resolver & resolver)
93 DBG << "apply solution " << *this << endl;
95 for (solver::detail::CSolutionActionList::const_iterator iter = _actions.begin();
96 iter != _actions.end(); ++iter) {
97 solver::detail::SolutionAction_constPtr action = *iter;
98 if (! action->execute (resolver))
100 WAR << "apply solution action failed: " << action << endl;
110 * Add an action to the actions list.
113 ProblemSolution::addAction (solver::detail::SolutionAction_constPtr action)
115 _actions.push_back (action);
120 ProblemSolution::clear()
125 ///////////////////////////////////////////////////////////////////////
127 /////////////////////////////////////////////////////////////////////////