00001 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 4 -*- */ 00002 /* QueueItemRequire.h 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 #ifndef ZYPP_SOLVER_DETAIL_QUEUEITEMREQUIRE_H 00023 #define ZYPP_SOLVER_DETAIL_QUEUEITEMREQUIRE_H 00024 00025 #include <iosfwd> 00026 #include <list> 00027 #include <string> 00028 00029 #include "zypp/solver/detail/QueueItem.h" 00030 00031 #include "zypp/Capability.h" 00032 00034 namespace zypp 00035 { 00036 00037 namespace solver 00038 { 00039 00040 namespace detail 00041 { 00042 00044 // CLASS NAME : QueueItemRequire_Ptr 00045 // CLASS NAME : QueueItemRequire_constPtr 00047 DEFINE_PTR_TYPE(QueueItemRequire); 00048 00050 // 00051 // CLASS NAME : QueueItemRequire 00052 00053 class QueueItemRequire : public QueueItem { 00054 00055 private: 00056 const Capability _capability; // the required capability 00057 bool _soft; 00058 00059 PoolItem_Ref _requiring_item; // who's requiring it 00060 00061 PoolItem_Ref _upgraded_item; 00062 PoolItem_Ref _lost_item; 00063 00064 bool _remove_only; 00065 bool _is_child; 00066 00067 public: 00068 00069 QueueItemRequire (const ResPool & pool, const Capability & cap, bool soft = false); 00070 virtual ~QueueItemRequire(); 00071 00072 // ---------------------------------- I/O 00073 00074 virtual std::ostream & dumpOn( std::ostream & str ) const; 00075 00076 friend std::ostream & operator<<(std::ostream & str, const QueueItemRequire & obj) 00077 { return obj.dumpOn (str); } 00078 00079 // ---------------------------------- accessors 00080 00081 bool isSoft (void) const { return _soft; } 00082 00083 const Capability & capability (void) const { return _capability; } 00084 00085 void setRemoveOnly (void) { _remove_only = true; } 00086 void setUpgradedPoolItem (PoolItem_Ref upgraded_item) { _upgraded_item = upgraded_item; } 00087 void setLostPoolItem (PoolItem_Ref lost_item) { _lost_item = lost_item; } 00088 00089 // ---------------------------------- methods 00090 00091 virtual bool process (ResolverContext_Ptr context, QueueItemList & qil); 00092 virtual QueueItem_Ptr copy (void) const; 00093 virtual int cmp (QueueItem_constPtr item) const; 00094 virtual bool isRedundant (ResolverContext_Ptr context) const { return false; } 00095 virtual bool isSatisfied (ResolverContext_Ptr context) const { return false; } 00096 00097 void addPoolItem (PoolItem_Ref item); 00098 00099 00100 }; 00101 00103 };// namespace detail 00106 };// namespace solver 00109 };// namespace zypp 00111 00112 #endif // ZYPP_SOLVER_DETAIL_QUEUEITEMREQUIRE_H