00001 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 4 -*- */ 00002 /* ResolverInfoMisc.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_RESOLVERINFOMISC_H 00023 #define ZYPP_SOLVER_DETAIL_RESOLVERINFOMISC_H 00024 00025 #include <string> 00026 00027 #include "zypp/ResPool.h" 00028 #include "zypp/Capability.h" 00029 00030 00031 #include "zypp/solver/detail/Types.h" 00032 #include "zypp/solver/detail/ResolverInfoContainer.h" 00033 00035 namespace zypp 00036 { 00037 00038 namespace solver 00039 { 00040 00041 namespace detail 00042 { 00043 00045 // 00046 // CLASS NAME : ResolverInfoMisc 00047 00048 class ResolverInfoMisc : public ResolverInfoContainer { 00049 public: 00050 typedef enum { 00051 NONE, 00052 CONFLICT, // conflicts [dep] 00053 OBSOLETE, // obsoletes [dep] 00054 REQUIRE // require [dep] 00055 } TriggerReason; 00056 00057 00058 00059 private: 00060 00061 Capability _capability; // capability leading to this info 00062 00063 PoolItem_Ref _other_item; 00064 Capability _other_capability; 00065 00066 std::string _action; 00067 TriggerReason _trigger; 00068 00069 public: 00070 00071 ResolverInfoMisc (ResolverInfoType detailedtype, PoolItem_Ref affected, int priority, const Capability & capability = Capability::noCap); 00072 virtual ~ResolverInfoMisc(); 00073 00074 // ---------------------------------- I/O 00075 00076 virtual std::ostream & dumpOn( std::ostream & str ) const; 00077 friend std::ostream& operator<<(std::ostream & str, const ResolverInfoMisc & obj) 00078 { return obj.dumpOn (str); } 00079 00080 // ---------------------------------- accessors 00081 00082 virtual std::string message (void) const; 00083 std::string action (void) const { return _action; } 00084 TriggerReason trigger (void) const { return _trigger; } 00085 00086 PoolItem_Ref other (void) const { return _other_item; } 00087 const Capability other_capability (void) const { return _other_capability; } 00088 const Capability capability(void) const { return _capability; } 00089 00090 // ---------------------------------- methods 00091 00092 virtual bool merge (ResolverInfo_Ptr to_be_merged); 00093 virtual ResolverInfo_Ptr copy (void) const; 00094 00095 void addAction (const std::string & action_msg); 00096 void addTrigger (const TriggerReason & trigger); 00097 00098 void setOtherPoolItem (PoolItem_Ref other); 00099 void setOtherCapability (const Capability & capability); 00100 }; 00101 00103 };// namespace detail 00106 };// namespace solver 00109 };// namespace zypp 00111 #endif // ZYPP_SOLVER_DETAIL_RESOLVERINFOMISC_H 00112