DownloadMode.cc

Go to the documentation of this file.
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( DownloadOnly );
00040       OUTS( DownloadInAdvance );
00041       OUTS( DownloadInHeaps );
00042       OUTS( DownloadAsNeeded );
00043 #undef OUTS
00044     }
00045     return str << "DownloadMode(" << int(obj) << ")";
00046   }
00047 
00048 
00050 } // namespace zypp

doxygen