libzypp 8.13.6
|
00001 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 4 -*- */ 00002 /* Helper.h 00003 * 00004 * Static helpers 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 #ifndef ZYPP_SOLVER_DETAIL_HELPER_H 00025 #define ZYPP_SOLVER_DETAIL_HELPER_H 00026 00027 #include <iosfwd> 00028 00029 #include "zypp/ResPool.h" 00030 #include "zypp/PoolItem.h" 00031 #include "zypp/Capabilities.h" 00032 #include "zypp/base/String.h" 00033 #include "zypp/solver/detail/Types.h" 00034 00036 namespace zypp 00037 { 00038 00039 namespace solver 00040 { 00041 00042 namespace detail 00043 { 00044 00046 // 00047 // CLASS NAME : Helper 00048 00049 class Helper { 00050 public: 00051 00052 // for name, find installed item which has same name 00053 // does *NOT* check edition 00054 // FIXME: should probably take provides/obsoletes into account for 00055 // renamed upgrades 00056 static PoolItem findInstalledByNameAndKind (const ResPool & pool, const std::string & name, const Resolvable::Kind & kind); 00057 00058 // for name, find uninstalled item which has same name 00059 static PoolItem findUninstalledByNameAndKind (const ResPool & pool, const std::string & name, const Resolvable::Kind & kind); 00060 00061 // for item, find installed item which has same name -> calls findInstalledByNameAndKind() 00062 // does *NOT* check edition 00063 // FIXME: should probably take provides/obsoletes into account for 00064 // renamed upgrades 00065 static PoolItem findInstalledItem (const ResPool & pool, PoolItem item); 00067 static PoolItem findInstalledItem (const std::vector<PoolItem> & pool, PoolItem item); 00068 00069 // for item, find uninstalled item which has same name and higher edition 00070 static PoolItem findUninstalledItem (const ResPool & pool, PoolItem item); 00071 00072 // for item, find uninstalled item which has same name and equal edition 00073 static PoolItem findReinstallItem (const ResPool & pool, PoolItem item); 00074 00075 static PoolItem findUpdateItem (const ResPool & pool, PoolItem item); 00077 static PoolItem findUpdateItem (const std::vector<PoolItem> & pool, PoolItem item); 00078 00079 // for item, check if this is the 'best' uninstalled (best arch, best version) item 00080 static bool isBestUninstalledItem (const ResPool & pool, PoolItem item); 00081 00082 // Human readable item 00083 static std::string itemToString (PoolItem item, bool shortVersion=false); 00084 static std::string capToString (const Capability & capability); 00085 00086 friend std::ostream& operator<<(std::ostream&, const PoolItemList & itemlist); 00087 00088 }; 00089 00091 };// namespace detail 00094 };// namespace solver 00097 };// namespace zypp 00099 00100 #endif // ZYPP_SOLVER_DETAIL_HELPER_H