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_CANT_SATISFY,                    // Can't satisfy requirement c
00070         // from QueueItemUninstall
00071     RESOLVER_INFO_TYPE_UNINSTALL_TO_BE_INSTALLED,       // p is to-be-installed, so it won't be unlinked.
00072     RESOLVER_INFO_TYPE_UNINSTALL_INSTALLED,             // p is required by installed, so it won't be unlinked.
00073     RESOLVER_INFO_TYPE_UNINSTALL_LOCKED,                // cant uninstall, its locked
00074         // from QueueItemConflict
00075     RESOLVER_INFO_TYPE_CONFLICT_CANT_INSTALL,           // to-be-installed p conflicts with q due to c
00076     RESOLVER_INFO_TYPE_CONFLICT_UNINSTALLABLE           // uninstalled p is marked uninstallable it conflicts [with q] due to c
00077 } ResolverInfoType;
00078 
00079 #define RESOLVER_INFO_PRIORITY_USER      500
00080 #define RESOLVER_INFO_PRIORITY_VERBOSE   100
00081 #define RESOLVER_INFO_PRIORITY_DEBUGGING   0
00082 
00083 typedef void (*ResolverInfoFn) (ResolverInfo_Ptr info, void *data);
00084 
00085 typedef std::list <ResolverInfo_Ptr> ResolverInfoList;
00086 
00088 //
00089 //      CLASS NAME : ResolverInfo
00090 
00091 class ResolverInfo : public base::ReferenceCounted, private base::NonCopyable {
00092 
00093   private:
00094 
00095     ResolverInfoType _type;
00096 
00097     PoolItem_Ref _affected;
00098 
00099     int _priority;
00100 
00101     bool _error;
00102     bool _important;
00103 
00104   protected:
00105 
00106     ResolverInfo (ResolverInfoType type, PoolItem_Ref affected, int priority);
00107 
00108   public:
00109 
00110     virtual ~ResolverInfo();
00111 
00112     void copy (ResolverInfo_constPtr from);
00113 
00114     // ---------------------------------- I/O
00115 
00116     static std::string toString (PoolItem_Ref item);
00117     static std::string toString (const Capability & capability);
00118 
00119     virtual std::ostream & dumpOn( std::ostream & str ) const;
00120     friend std::ostream& operator<<(std::ostream & str, const ResolverInfo & obj)
00121     { return obj.dumpOn (str); }
00122 
00123     // ---------------------------------- accessors
00124 
00125     ResolverInfoType type (void) const { return _type; }
00126     PoolItem_Ref affected (void) const { return _affected; }
00127     int priority (void) const { return _priority; }
00128 
00129     int error (void) const { return _error; }
00130     void flagAsError (void) { _error = true; }
00131     int important (void) const { return _important || _error; }
00132     void flagAsImportant (void) { _important = true; }
00133 
00134     // ---------------------------------- methods
00135 
00136     virtual std::string message (void) const;
00137     bool merge (ResolverInfo_Ptr to_be_merged);
00138     virtual ResolverInfo_Ptr copy (void) const;
00139 
00140     bool isAbout (PoolItem_Ref item) const;
00141 };
00142 
00144     };// namespace detail
00147   };// namespace solver
00150 };// namespace zypp
00152 #endif // ZYPP_SOLVER_DETAIL_RESOLVER_INFO_H
00153 

Generated on Fri Jul 4 16:57:59 2008 for zypp by  doxygen 1.5.0