libzypp
10.5.0
|
00001 /*---------------------------------------------------------------------\ 00002 | ____ _ __ __ ___ | 00003 | |__ / \ / / . \ . \ | 00004 | / / \ V /| _/ _/ | 00005 | / /__ | | | | | | | 00006 | /_____||_| |_| |_| | 00007 | | 00008 \---------------------------------------------------------------------*/ 00012 #include <iostream> 00013 //#include "zypp/base/Logger.h" 00014 00015 #include "zypp/ResStatus.h" 00016 00017 using std::endl; 00018 00020 namespace zypp 00021 { 00022 00023 const ResStatus ResStatus::toBeInstalled (UNINSTALLED, UNDETERMINED, TRANSACT); 00024 const ResStatus ResStatus::toBeUninstalled (INSTALLED, UNDETERMINED, TRANSACT); 00025 const ResStatus ResStatus::toBeUninstalledDueToUpgrade (INSTALLED, UNDETERMINED, TRANSACT, EXPLICIT_INSTALL, DUE_TO_UPGRADE); 00026 const ResStatus ResStatus::toBeUninstalledDueToObsolete(INSTALLED, UNDETERMINED, TRANSACT, EXPLICIT_INSTALL, DUE_TO_OBSOLETE); 00027 00029 // 00030 // METHOD NAME : ResStatus::ResStatus 00031 // METHOD TYPE : Ctor 00032 // 00033 ResStatus::ResStatus() 00034 {} 00035 00037 // 00038 // METHOD NAME : ResStatus::ResStatus 00039 // METHOD TYPE : Ctor 00040 // 00041 ResStatus::ResStatus( bool isInstalled_r ) 00042 : _bitfield( isInstalled_r ? INSTALLED : UNINSTALLED ) 00043 {} 00044 00046 // 00047 // METHOD NAME : ResStatus::~ResStatus 00048 // METHOD TYPE : Dtor 00049 // 00050 ResStatus::~ResStatus() 00051 {} 00052 00053 00054 ResStatus::ResStatus (enum StateValue s, enum ValidateValue v, enum TransactValue t, enum InstallDetailValue i, enum RemoveDetailValue r) 00055 : _bitfield (s) 00056 { 00057 fieldValueAssign<ValidateField>(v); 00058 fieldValueAssign<TransactField>(t); 00059 if (t == TRANSACT) { 00060 if (s == INSTALLED) fieldValueAssign<TransactDetailField>(r); 00061 else fieldValueAssign<TransactDetailField>(i); 00062 } 00063 } 00064 00065 00066 /****************************************************************** 00067 ** 00068 ** FUNCTION NAME : operator<< 00069 ** FUNCTION TYPE : std::ostream & 00070 */ 00071 std::ostream & operator<<( std::ostream & str, const ResStatus & obj ) 00072 { 00073 str << (obj.isInstalled() ? "I" : "U"); 00074 00075 str << (obj.isBroken() ? "B" : 00076 ( obj.isSatisfied() ? "S" : 00077 ( obj.isNonRelevant() ? "N" : "_") ) ); 00078 00079 str << (obj.transacts () ? "T" 00080 : (obj.isLocked() ? "L" : "_") ); 00081 00082 if (obj.isBySolver()) str << "s"; 00083 else if (obj.isByApplLow()) str << "l"; 00084 else if (obj.isByApplHigh()) str << "h"; 00085 else if (obj.isByUser()) str << "u"; 00086 00087 str << (obj.isToBeUninstalledDueToObsolete() ? "O" : 00088 ( obj.isToBeUninstalledDueToUpgrade() ? "U" : 00089 ( obj.isToBeInstalledSoft() ? "S" : "_" ) ) ); 00090 00091 str << (obj.isOrphaned() ? "o" : "" ); 00092 str << (obj.isRecommended() ? "r" : "" ); 00093 str << (obj.isSuggested() ? "s" : "" ); 00094 00095 return str; 00096 } 00097 00098 00099 #define OUTS(X) case ResStatus::X: return str << #X; break 00100 00101 std::ostream & operator<<( std::ostream & str, ResStatus::TransactValue obj ) 00102 { 00103 switch ( obj ) 00104 { 00105 OUTS( KEEP_STATE ); 00106 OUTS( LOCKED ); 00107 OUTS( TRANSACT ); 00108 } 00109 return str; 00110 } 00111 00112 std::ostream & operator<<( std::ostream & str, ResStatus::TransactByValue obj ) 00113 { 00114 switch ( obj ) 00115 { 00116 OUTS( SOLVER ); 00117 OUTS( APPL_LOW ); 00118 OUTS( APPL_HIGH ); 00119 OUTS( USER ); 00120 } 00121 return str; 00122 } 00123 00125 } // namespace zypp