ResolverInfo.h

Go to the documentation of this file.
00001 #/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 4 -*- */
00002 /* ResolverInfo.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_RESOLVER_INFO_H
00023 #define ZYPP_SOLVER_DETAIL_RESOLVER_INFO_H
00024 
00025 #include "zypp/solver/detail/Types.h"
00026 
00028 namespace zypp
00029 { 
00030 
00031   namespace solver
00032   { 
00033 
00034     namespace detail
00035     { 
00036 
00037 typedef enum {
00038     RESOLVER_INFO_TYPE_INVALID = 0,
00039     RESOLVER_INFO_TYPE_NEEDED_BY,
00040     RESOLVER_INFO_TYPE_CONFLICTS_WITH,
00041     RESOLVER_INFO_TYPE_OBSOLETES,
00042     RESOLVER_INFO_TYPE_DEPENDS_ON,
00043     RESOLVER_INFO_TYPE_CHILD_OF,
00044     RESOLVER_INFO_TYPE_MISSING_REQ,
00045         // from ResolverContext
00046     RESOLVER_INFO_TYPE_INVALID_SOLUTION,                // Marking this resolution attempt as invalid.
00047     RESOLVER_INFO_TYPE_UNINSTALLABLE,                   // Marking p as uninstallable
00048     RESOLVER_INFO_TYPE_REJECT_INSTALL,                  // p is scheduled to be installed, but this is not possible because of dependency problems.
00049     RESOLVER_INFO_TYPE_INSTALL_TO_BE_UNINSTALLED,       // Can't install p since it is already marked as needing to be uninstalled
00050     RESOLVER_INFO_TYPE_INSTALL_UNNEEDED,                // Can't install p since it is does not apply to this system.
00051     RESOLVER_INFO_TYPE_INSTALL_PARALLEL,                // Can't install p, since a resolvable of the same name is already marked as needing to be installed.
00052     RESOLVER_INFO_TYPE_INCOMPLETES,                     // This would invalidate p
00053         // from QueueItemEstablish
00054     RESOLVER_INFO_TYPE_ESTABLISHING,                    // Establishing p
00055         // from QueueItemInstall
00056     RESOLVER_INFO_TYPE_INSTALLING,                      // Installing p
00057     RESOLVER_INFO_TYPE_UPDATING,                        // Updating p
00058     RESOLVER_INFO_TYPE_SKIPPING,                        // Skipping p, already installed
00059         // from QueueItemRequire
00060     RESOLVER_INFO_TYPE_NO_OTHER_PROVIDER,               // There are no alternative installed providers of c [for p]
00061     RESOLVER_INFO_TYPE_NO_PROVIDER,                     // There are no installable providers of c [for p]
00062     RESOLVER_INFO_TYPE_NO_UPGRADE,                      // Upgrade to q to avoid removing p is not possible.
00063     RESOLVER_INFO_TYPE_UNINSTALL_PROVIDER,              // p provides c but is scheduled to be uninstalled
00064     RESOLVER_INFO_TYPE_KEEP_PROVIDER,                   // p provides c but is scheduled to be kept
00065     RESOLVER_INFO_TYPE_PARALLEL_PROVIDER,               // p provides c but another version is already installed
00066     RESOLVER_INFO_TYPE_NOT_INSTALLABLE_PROVIDER,        // p provides c but is uninstallable
00067     RESOLVER_INFO_TYPE_LOCKED_PROVIDER,                 // p provides c but is locked
00068     RESOLVER_INFO_TYPE_OTHER_ARCH_PROVIDER,             // p provides c but has other architecture
00069     RESOLVER_INFO_TYPE_OTHER_VENDOR_PROVIDER,           // p provides c but has other vendor    
00070     RESOLVER_INFO_TYPE_CANT_SATISFY,                    // Can't satisfy requirement c
00071         // from QueueItemUninstall
00072     RESOLVER_INFO_TYPE_UNINSTALL_TO_BE_INSTALLED,       // p is to-be-installed, so it won't be unlinked.
00073     RESOLVER_INFO_TYPE_UNINSTALL_INSTALLED,             // p is required by installed, so it won't be unlinked.
00074     RESOLVER_INFO_TYPE_UNINSTALL_LOCKED,                // cant uninstall, its locked
00075         // from QueueItemConflict
00076     RESOLVER_INFO_TYPE_CONFLICT_CANT_INSTALL,           // to-be-installed p conflicts with q due to c
00077     RESOLVER_INFO_TYPE_CONFLICT_UNINSTALLABLE           // uninstalled p is marked uninstallable it conflicts [with q] due to c
00078 } ResolverInfoType;
00079 
00080 #define RESOLVER_INFO_PRIORITY_USER      500
00081 #define RESOLVER_INFO_PRIORITY_VERBOSE   100
00082 #define RESOLVER_INFO_PRIORITY_DEBUGGING   0
00083 
00084 typedef void (*ResolverInfoFn) (ResolverInfo_Ptr info, void *data);
00085 
00086 typedef std::list <ResolverInfo_Ptr> ResolverInfoList;
00087 
00089 //
00090 //      CLASS NAME : ResolverInfo
00091 
00092 class ResolverInfo : public base::ReferenceCounted, private base::NonCopyable {
00093 
00094   private:
00095 
00096     ResolverInfoType _type;
00097 
00098     PoolItem_Ref _affected;
00099 
00100     int _priority;
00101 
00102     bool _error;
00103     bool _important;
00104 
00105   protected:
00106 
00107     ResolverInfo (ResolverInfoType type, PoolItem_Ref affected, int priority);
00108 
00109   public:
00110 
00111     virtual ~ResolverInfo();
00112 
00113     void copy (ResolverInfo_constPtr from);
00114 
00115     // ---------------------------------- I/O
00116 
00117     static std::string toString (PoolItem_Ref item, bool shortVersion=false);
00118     static std::string toString (const Capability & capability);
00119 
00120     virtual std::ostream & dumpOn( std::ostream & str ) const;
00121     friend std::ostream& operator<<(std::ostream & str, const ResolverInfo & obj)
00122     { return obj.dumpOn (str); }
00123 
00124     // ---------------------------------- accessors
00125 
00126     ResolverInfoType type (void) const { return _type; }
00127     PoolItem_Ref affected (void) const { return _affected; }
00128     int priority (void) const { return _priority; }
00129 
00130     int error (void) const { return _error; }
00131     void flagAsError (void) { _error = true; }
00132     int important (void) const { return _important || _error; }
00133     void flagAsImportant (void) { _important = true; }
00134 
00135     // ---------------------------------- methods
00136 
00137     virtual std::string message (void) const;
00138     bool merge (ResolverInfo_Ptr to_be_merged);
00139     virtual ResolverInfo_Ptr copy (void) const;
00140 
00141     bool isAbout (PoolItem_Ref item) const;
00142 };
00143 
00145     };// namespace detail
00148   };// namespace solver
00151 };// namespace zypp
00153 #endif // ZYPP_SOLVER_DETAIL_RESOLVER_INFO_H
00154 

Generated on Tue Sep 25 19:23:07 2007 for libzypp by  doxygen 1.5.3