ProblemSolutionUninstall.cc

Go to the documentation of this file.
00001 
00002 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 4 -*- */
00003 /* ProblemSolution.cc
00004  *
00005  * Easy-to use interface to the ZYPP dependency resolver
00006  *
00007  * Copyright (C) 2000-2002 Ximian, Inc.
00008  * Copyright (C) 2005 SUSE Linux Products GmbH
00009  *
00010  * This program is free software; you can redistribute it and/or
00011  * modify it under the terms of the GNU General Public License,
00012  * version 2, as published by the Free Software Foundation.
00013  *
00014  * This program is distributed in the hope that it will be useful, but
00015  * WITHOUT ANY WARRANTY; without even the implied warranty of
00016  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00017  * General Public License for more details.
00018  *
00019  * You should have received a copy of the GNU General Public License
00020  * along with this program; if not, write to the Free Software
00021  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
00022  * 02111-1307, USA.
00023  */
00024 
00025 #include <sstream>
00026 
00027 #include "zypp/base/String.h"
00028 #include "zypp/base/Gettext.h"
00029 #include "zypp/solver/detail/ProblemSolutionUninstall.h"
00030 #include "zypp/solver/detail/ResolverInfo.h"
00031 
00032 using namespace std;
00033 
00035 namespace zypp
00036 { 
00037 
00038   namespace solver
00039   { 
00040 
00041     namespace detail
00042     { 
00043 
00044 IMPL_PTR_TYPE(ProblemSolutionUninstall);
00045 
00046 //---------------------------------------------------------------------------
00047 ProblemSolutionUninstall::ProblemSolutionUninstall( ResolverProblem_Ptr parent, PoolItem_Ref item,
00048                           const std::string & descr,
00049                           const std::string & detail)
00050     : ProblemSolution (parent, descr, detail)
00051 {
00052     addAction ( new TransactionSolutionAction (item, REMOVE));
00053 }
00054 
00055         
00056 
00057 ProblemSolutionUninstall::ProblemSolutionUninstall( ResolverProblem_Ptr parent,
00058                                                     PoolItem_Ref item)
00059     : ProblemSolution (parent, "", "")
00060 {
00061     ResStatus status = item.status();
00062     if (status.isInstalled()) {
00063         // TranslatorExplanation %s = name of package, patch, selection ...
00064         _description = str::form (_("delete %s"), item->name().c_str() );
00065         // TranslatorExplanation %s = name of package, patch, selection ...         
00066         _details = str::form (_("delete %s"), ResolverInfo::toString (item).c_str());
00067     } else {
00068         // TranslatorExplanation %s = name of package, patch, selection ...     
00069         _description = str::form (_("do not install %s"), item->name().c_str() );
00070         // TranslatorExplanation %s = name of package, patch, selection ...         
00071         _details = str::form (_("do not install %s"), ResolverInfo::toString (item).c_str());
00072     }
00073 
00074     addAction ( new TransactionSolutionAction (item, REMOVE));
00075 }
00076 
00077 ProblemSolutionUninstall::ProblemSolutionUninstall( ResolverProblem_Ptr parent,
00078                                                     PoolItemList & itemlist)
00079     : ProblemSolution (parent, "", "")
00080 {
00081     _description = _("Do not install or delete concerning resolvables");
00082 
00083     for (PoolItemList::iterator iter = itemlist.begin();
00084          iter != itemlist.end(); iter++) {
00085         PoolItem_Ref item = *iter;
00086         addAction ( new TransactionSolutionAction (item, REMOVE));
00087     }
00088     
00089     ostringstream details;
00090     details << _actions;    
00091     _details = details.str();
00092 }
00093 
00095     };// namespace detail
00098   };// namespace solver
00101 };// namespace zypp

Generated on Thu Jul 6 00:07:23 2006 for zypp by  doxygen 1.4.6