QueueItemUninstall.h

Go to the documentation of this file.
00001 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 4 -*- */
00002 /* QueueItemUninstall.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_QUEUITEMUNINSTALL_H
00023 #define ZYPP_SOLVER_DETAIL_QUEUITEMUNINSTALL_H
00024 
00025 #include "zypp/solver/detail/Types.h"
00026 
00027 #include "zypp/solver/detail/QueueItem.h"
00028 #include "zypp/Capability.h"
00029 
00031 namespace zypp
00032 { 
00033 
00034   namespace solver
00035   { 
00036 
00037     namespace detail
00038     { 
00039 
00040 DEFINE_PTR_TYPE(QueueItemUninstall);
00041 
00043 //
00044 //      CLASS NAME : QueueItemUninstall
00045 
00046 class QueueItemUninstall : public QueueItem {
00047 
00048   public:
00049     typedef enum {
00050       CONFLICT,                         // conflicts [dep]
00051       OBSOLETE,                         // obsolets [dep]
00052       UNSATISFIED,                      // unsatisfied dep, must be unistalled since required dep isnt provided anymore
00053       BACKOUT,                          // back out during verify
00054       UPGRADE,                          // its being upgraded, so the original get uninstalled, find out if this breaks something
00055       DUPLICATE,                        // duplicate install
00056       EXPLICIT                          // user request
00057     } UninstallReason;
00058 
00059 
00060   private:
00061     PoolItem_Ref _item;                 // the item to-be-uninstalled
00062     UninstallReason _reason;
00063     bool _soft;
00064     Capability _cap_leading_to_uninstall;
00065     PoolItem_Ref _upgraded_to;          // if the uninstall is actually an upgrade
00066 
00067     bool _explicitly_requested;
00068     bool _remove_only;
00069     bool _due_to_conflict;
00070     bool _due_to_obsolete;
00071     bool _unlink;
00072     PoolItem_Ref _obsoletes_item;       // item which has caused (has the obsoletes) this request
00073 
00074   public:
00075 
00076     QueueItemUninstall (const ResPool & pool, PoolItem_Ref item, UninstallReason reason, bool soft = false);
00077     virtual ~QueueItemUninstall();
00078 
00079     // ---------------------------------- I/O
00080 
00081     virtual std::ostream & dumpOn( std::ostream & str ) const;
00082 
00083     friend std::ostream& operator<<(std::ostream& str, const QueueItemUninstall & obj)
00084     { return obj.dumpOn (str); }
00085 
00086     // ---------------------------------- accessors
00087 
00088     UninstallReason reason (void) const         { return _reason; }
00089     void setCapability (const Capability & cap) { _cap_leading_to_uninstall = cap; }
00090     void setExplicitlyRequested (void)          { _explicitly_requested = true; }
00091     void setRemoveOnly (void)                   { _remove_only = true; }
00092     void setUpgradedTo (PoolItem_Ref item)              { _upgraded_to = item; }
00093     void setDueToConflict (void)                { _due_to_conflict = true; }
00094     void setDueToObsolete (const PoolItem_Ref item)
00095         { _due_to_obsolete = true; _obsoletes_item = item; }
00096     void setUnlink (void);
00097 
00098     // ---------------------------------- methods
00099 
00100     virtual bool process (ResolverContext_Ptr context, QueueItemList & qil);
00101     virtual QueueItem_Ptr copy (void) const;
00102     virtual int cmp (QueueItem_constPtr item) const;
00103     virtual bool isRedundant (ResolverContext_Ptr context) const { return false; }
00104     virtual bool isSatisfied (ResolverContext_Ptr context) const { return false; }
00105 
00106 };
00107 
00109     };// namespace detail
00112   };// namespace solver
00115 };// namespace zypp
00117 
00118 #endif // ZYPP_SOLVER_DETAIL_QUEUITEMUNINSTALL_H

Generated on Thu Jul 6 00:07:23 2006 for zypp by  doxygen 1.4.6