00001 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 4 -*- */ 00002 /* ResolverInfoDependsOn.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/ResolverInfoDependsOn.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(ResolverInfoDependsOn); 00043 00044 //--------------------------------------------------------------------------- 00045 00046 std::ostream & 00047 ResolverInfoDependsOn::dumpOn( std::ostream & os ) const 00048 { 00049 ResolverInfo::dumpOn (os); 00050 00051 ostringstream affected_str; 00052 affected_str << ResolverInfo::toString (affected()); 00053 00054 // Translator: all.%s = name of package,patch,.... 00055 os << str::form (_("%s depended on %s"), 00056 affected_str.str().c_str(), 00057 itemsToString(false).c_str()); 00058 return os; 00059 } 00060 00061 string 00062 ResolverInfoDependsOn::message( ) const 00063 { 00064 string affected_str = ResolverInfo::toString(affected()); 00065 string container_str = itemsToString( true ); 00066 00067 // TranslatorExplanation: 1.%s name of package, 2.%s list of names 00068 // TranslatorExplanation: 1.%s is dependent on list of names 00069 return str::form (_("%s dependend on %s"), 00070 affected_str.c_str(), 00071 container_str.c_str()); 00072 } 00073 00074 //--------------------------------------------------------------------------- 00075 00076 ResolverInfoDependsOn::ResolverInfoDependsOn (PoolItem_Ref item, PoolItem_Ref on) 00077 : ResolverInfoContainer (RESOLVER_INFO_TYPE_DEPENDS_ON, item, RESOLVER_INFO_PRIORITY_USER, on) 00078 { 00079 } 00080 00081 00082 ResolverInfoDependsOn::~ResolverInfoDependsOn () 00083 { 00084 } 00085 00086 //--------------------------------------------------------------------------- 00087 00088 ResolverInfo_Ptr 00089 ResolverInfoDependsOn::copy (void) const 00090 { 00091 ResolverInfoDependsOn_Ptr cpy = new ResolverInfoDependsOn(affected(), PoolItem_Ref()); 00092 00093 ((ResolverInfoContainer_Ptr)cpy)->copy (this); 00094 00095 return cpy; 00096 } 00097 00098 //--------------------------------------------------------------------------- 00100 };// namespace detail 00103 };// namespace solver 00106 };// namespace zypp 00108