libzypp
10.5.0
|
00001 /*---------------------------------------------------------------------\ 00002 | ____ _ __ __ ___ | 00003 | |__ / \ / / . \ . \ | 00004 | / / \ V /| _/ _/ | 00005 | / /__ | | | | | | | 00006 | /_____||_| |_| |_| | 00007 | | 00008 \---------------------------------------------------------------------*/ 00012 #include <iostream> 00013 00014 #include "zypp/base/String.h" 00015 #include "zypp/DownloadMode.h" 00016 00017 using std::endl; 00018 00020 namespace zypp 00021 { 00022 00023 bool deserialize( const std::string & str_r, DownloadMode & result_r ) 00024 { 00025 #define OUTS(VAL) if ( str::compareCI( str_r, #VAL ) == 0 ) { result_r = VAL; return true; } 00026 OUTS( DownloadOnly ); 00027 OUTS( DownloadInAdvance ); 00028 OUTS( DownloadInHeaps ); 00029 OUTS( DownloadAsNeeded ); 00030 #undef OUTS 00031 return false; 00032 } 00033 00034 std::ostream & operator<<( std::ostream & str, DownloadMode obj ) 00035 { 00036 switch ( obj ) 00037 { 00038 #define OUTS(VAL) case VAL: return str << #VAL; break 00039 OUTS( DownloadDefault ); 00040 OUTS( DownloadOnly ); 00041 OUTS( DownloadInAdvance ); 00042 OUTS( DownloadInHeaps ); 00043 OUTS( DownloadAsNeeded ); 00044 #undef OUTS 00045 } 00046 return str << "DownloadMode(" << int(obj) << ")"; 00047 } 00048 00049 00051 } // namespace zypp