00001 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 4 -*- */ 00002 /* ResolverInfoNeededBy.cc 00003 * 00004 * Copyright (C) 2000-2002 Ximian, Inc. 00005 * Copyright (C) 2005 SUSE Linux Products GmbH 00006 * 00007 * This program is free software; you can redistribute it and/or 00008 * modify it under the terms of the GNU General Public License, 00009 * version 2, as published by the Free Software Foundation. 00010 * 00011 * This program is distributed in the hope that it will be useful, but 00012 * WITHOUT ANY WARRANTY; without even the implied warranty of 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00014 * General Public License for more details. 00015 * 00016 * You should have received a copy of the GNU General Public License 00017 * along with this program; if not, write to the Free Software 00018 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 00019 * 02111-1307, USA. 00020 */ 00021 00022 #include <map> 00023 #include <sstream> 00024 00025 #include "zypp/solver/detail/ResolverInfo.h" 00026 #include "zypp/solver/detail/ResolverInfoNeededBy.h" 00027 #include "zypp/base/String.h" 00028 #include "zypp/base/Gettext.h" 00029 00031 namespace zypp 00032 { 00033 00034 namespace solver 00035 { 00036 00037 namespace detail 00038 { 00039 00040 using namespace std; 00041 00042 IMPL_PTR_TYPE(ResolverInfoNeededBy); 00043 00044 //--------------------------------------------------------------------------- 00045 00046 00047 std::ostream & 00048 ResolverInfoNeededBy::dumpOn( std::ostream & os ) const 00049 { 00050 ResolverInfo::dumpOn (os); 00051 00052 ostringstream affected_str; 00053 affected_str << ResolverInfo::toString (affected()); 00054 00055 // Translator: all.%s = name of package,patch,... 00056 os << str::form (_("%s is needed by %s"), 00057 affected_str.str().c_str(), 00058 itemsToString(true).c_str()); 00059 return os; 00060 } 00061 00062 string 00063 ResolverInfoNeededBy::message( ) const 00064 { 00065 string affected_str = ResolverInfo::toString(affected()); 00066 string container_str = itemsToString( false ); 00067 00068 // TranslatorExplanation: 1.%s name of package, 2.%s list of names 00069 // TranslatorExplanation: 1.%s is needed by multiple others 00070 return str::form (_("%s needed by %s"), 00071 affected_str.c_str(), 00072 container_str.c_str()); 00073 } 00074 00075 //--------------------------------------------------------------------------- 00076 00077 ResolverInfoNeededBy::ResolverInfoNeededBy (PoolItem_Ref item) 00078 : ResolverInfoContainer (RESOLVER_INFO_TYPE_NEEDED_BY, item, RESOLVER_INFO_PRIORITY_USER) 00079 { 00080 } 00081 00082 00083 ResolverInfoNeededBy::~ResolverInfoNeededBy () 00084 { 00085 } 00086 00087 //--------------------------------------------------------------------------- 00088 00089 ResolverInfo_Ptr 00090 ResolverInfoNeededBy::copy (void) const 00091 { 00092 ResolverInfoNeededBy_Ptr cpy = new ResolverInfoNeededBy(affected()); 00093 00094 ((ResolverInfoContainer_Ptr)cpy)->copy (this); 00095 00096 return cpy; 00097 } 00098 00100 };// namespace detail 00103 };// namespace solver 00106 };// namespace zypp 00108