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 00066 public: 00067 00068 QueueItemRequire (const ResPool & pool, const Capability & cap, bool soft = false); 00069 virtual ~QueueItemRequire(); 00070 00071 // ---------------------------------- I/O 00072 00073 virtual std::ostream & dumpOn( std::ostream & str ) const; 00074 00075 friend std::ostream & operator<<(std::ostream & str, const QueueItemRequire & obj) 00076 { return obj.dumpOn (str); } 00077 00078 // ---------------------------------- accessors 00079 00080 bool isSoft (void) const { return _soft; } 00081 00082 const Capability & capability (void) const { return _capability; } 00083 00084 void setRemoveOnly (void) { _remove_only = true; } 00085 void setUpgradedPoolItem (PoolItem_Ref upgraded_item) { _upgraded_item = upgraded_item; } 00086 void setLostPoolItem (PoolItem_Ref lost_item) { _lost_item = lost_item; } 00087 00088 // ---------------------------------- methods 00089 00090 virtual bool process (const QueueItemList & mainQueue, ResolverContext_Ptr context, QueueItemList & qil); 00091 virtual QueueItem_Ptr copy (void) const; 00092 virtual int cmp (QueueItem_constPtr item) const; 00093 virtual bool isRedundant (ResolverContext_Ptr context) const { return false; } 00094 virtual bool isSatisfied (ResolverContext_Ptr context) const { return false; } 00095 00096 void addPoolItem (PoolItem_Ref item); 00097 00098 00099 }; 00100 00102 };// namespace detail 00105 };// namespace solver 00108 };// namespace zypp 00110 00111 #endif // ZYPP_SOLVER_DETAIL_QUEUEITEMREQUIRE_H
1.5.3