libzypp: zypp/ResolverFocus.cc Source File

libzypp 17.36.6

ResolverFocus.cc
Go to the documentation of this file.
1/*---------------------------------------------------------------------\
2| ____ _ __ __ ___ |
3| |__ / \ / / . \ . \ |
4| / / \ V /| _/ _/ |
5| / /__ | | | | | | |
6| /_____||_| |_| |_| |
7| |
8\---------------------------------------------------------------------*/
11#include <iostream>
12#include <zypp/base/Logger.h>
13#include <zypp/base/String.h>
14#include <zypp/base/Exception.h>
15#include <zypp/ResolverFocus.h>
16
17using std::endl;
18
20namespace zypp
21{
22 std::string asString( const ResolverFocus & val_r )
23 {
24 switch ( val_r )
25 {
26#define OUTS(V) case ResolverFocus::V: return #V; break
27 OUTS( Default );
28 OUTS( Job );
29 OUTS( Installed );
30 OUTS( Update );
31#undef OUTS
32 }
33 // Oops!
34 std::string ret { str::Str() << "ResolverFocus(" << static_cast<int>(val_r) << ")" };
35 WAR << "asString: dubious " << ret << endl;
36 return ret;
37 }
38
39 bool fromString( const std::string & val_r, ResolverFocus & ret_r )
40 {
41 switch ( val_r[0] )
42 {
43#define OUTS(V) if ( ::strcasecmp( val_r.c_str(), #V ) == 0 ) { ret_r = ResolverFocus::V; return true; }
44 case 'D':
45 case 'd':
46 OUTS( Default );
47 break;
48
49 case 'J':
50 case 'j':
51 OUTS( Job );
52 break;
53
54 case 'I':
55 case 'i':
56 OUTS( Installed );
57 break;
58
59 case 'U':
60 case 'u':
61 OUTS( Update );
62 break;
63
64 case '\0':
65 ret_r = ResolverFocus::Default;
66 return true;
67 break;
68#undef OUTS
69 }
70 // Oops!
71 WAR << "fromString: unknown ResolverFocus '" << val_r << "'" << endl;
72 return false;
73 }
74} // namespace zypp
ResolverFocus.h
OUTS
#define OUTS(V)
zypp
Easy-to use interface to the ZYPP dependency resolver.
Definition Application.cc:20
zypp::fromString
bool fromString(const std::string &val_r, ResolverFocus &ret_r)
Definition ResolverFocus.cc:39
zypp::ResolverFocus
ResolverFocus
The resolver's general attitude.
Definition ResolverFocus.h:24
zypp::ResolverFocus::Update
@ Update
Focus on updating requested packages and their dependencies as much as possible.
Definition ResolverFocus.h:28
zypp::ResolverFocus::Default
@ Default
Request the standard behavior (as defined in zypp.conf or 'Job')
Definition ResolverFocus.h:25
zypp::ResolverFocus::Installed
@ Installed
Focus on applying as little changes to the installed packages as needed.
Definition ResolverFocus.h:27
zypp::ResolverFocus::Job
@ Job
Focus on installing the best version of the requested packages.
Definition ResolverFocus.h:26
zypp::asString
std::string asString(const Patch::Category &obj)
Definition Patch.cc:122
zypp::str::Str
Convenient building of std::string via std::ostringstream Basically a std::ostringstream autoconverti...
Definition String.h:212
WAR
#define WAR
Definition Logger.h:101
Exception.h
Logger.h
String.h