libzypp: zypp/DownloadMode.cc Source File

libzypp 17.38.11

DownloadMode.cc
Go to the documentation of this file.
1/*---------------------------------------------------------------------\
2| ____ _ __ __ ___ |
3| |__ / \ / / . \ . \ |
4| / / \ V /| _/ _/ |
5| / /__ | | | | | | |
6| /_____||_| |_| |_| |
7| |
8\---------------------------------------------------------------------*/
12#include <iostream>
13
14#include <zypp-core/base/String.h>
15#include <zypp/DownloadMode.h>
16
17using std::endl;
18
20namespace zypp
21{
22
23 bool deserialize( const std::string & str_r, DownloadMode & result_r )
24 {
25#define OUTS(VAL) if ( str::compareCI( str_r, #VAL ) == 0 ) { result_r = VAL; return true; }
26 OUTS( DownloadOnly );
27 OUTS( DownloadInAdvance );
28 OUTS( DownloadInHeaps );
29 OUTS( DownloadAsNeeded );
30#undef OUTS
31 return false;
32 }
33
34 std::ostream & operator<<( std::ostream & str, DownloadMode obj )
35 {
36 switch ( obj )
37 {
38#define OUTS(VAL) case VAL: return str << #VAL; break
39 OUTS( DownloadDefault );
40 OUTS( DownloadOnly );
41 OUTS( DownloadInAdvance );
42 OUTS( DownloadInHeaps );
43 OUTS( DownloadAsNeeded );
44#undef OUTS
45 }
46 return str << "DownloadMode(" << int(obj) << ")";
47 }
48
49
51} // namespace zypp
OUTS
#define OUTS(VAL)
DownloadMode.h
String.h
str
String related utilities and Regular expression matching.
zypp
Easy-to use interface to the ZYPP dependency resolver.
Definition CodePitfalls.doc:2
zypp::deserialize
bool deserialize(const std::string &str_r, DownloadMode &result_r)
relates: DownloadMode Parse from string.
Definition DownloadMode.cc:23
zypp::operator<<
std::ostream & operator<<(std::ostream &str, const Capabilities &obj)
relates: Capabilities Stream output
Definition Capabilities.cc:65
zypp::DownloadMode
DownloadMode
Supported commit download policies.
Definition DownloadMode.h:25
zypp::DownloadInHeaps
@ DownloadInHeaps
Definition DownloadMode.h:31
zypp::DownloadOnly
@ DownloadOnly
Definition DownloadMode.h:27
zypp::DownloadAsNeeded
@ DownloadAsNeeded
Definition DownloadMode.h:34
zypp::DownloadInAdvance
@ DownloadInAdvance
Definition DownloadMode.h:29
zypp::DownloadDefault
@ DownloadDefault
libzypp will decide what to do.
Definition DownloadMode.h:26