/
DownloadMode.cc
52 lines (45 loc) · 1.69 KB
/
DownloadMode.cc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
/*---------------------------------------------------------------------\
| ____ _ __ __ ___ |
| |__ / \ / / . \ . \ |
| / / \ V /| _/ _/ |
| / /__ | | | | | | |
| /_____||_| |_| |_| |
| |
\---------------------------------------------------------------------*/
/** \file zypp/DownloadMode.cc
*
*/
#include <iostream>
#include "zypp/base/String.h"
#include "zypp/DownloadMode.h"
using std::endl;
///////////////////////////////////////////////////////////////////
namespace zypp
{ /////////////////////////////////////////////////////////////////
bool deserialize( const std::string & str_r, DownloadMode & result_r )
{
#define OUTS(VAL) if ( str::compareCI( str_r, #VAL ) == 0 ) { result_r = VAL; return true; }
OUTS( DownloadOnly );
OUTS( DownloadInAdvance );
OUTS( DownloadInHeaps );
OUTS( DownloadAsNeeded );
#undef OUTS
return false;
}
std::ostream & operator<<( std::ostream & str, DownloadMode obj )
{
switch ( obj )
{
#define OUTS(VAL) case VAL: return str << #VAL; break
OUTS( DownloadDefault );
OUTS( DownloadOnly );
OUTS( DownloadInAdvance );
OUTS( DownloadInHeaps );
OUTS( DownloadAsNeeded );
#undef OUTS
}
return str << "DownloadMode(" << int(obj) << ")";
}
/////////////////////////////////////////////////////////////////
} // namespace zypp
///////////////////////////////////////////////////////////////////