libzypp: zypp/Dep.h Source File

libzypp 17.38.14

Dep.h
Go to the documentation of this file.
1/*---------------------------------------------------------------------\
2| ____ _ __ __ ___ |
3| |__ / \ / / . \ . \ |
4| / / \ V /| _/ _/ |
5| / /__ | | | | | | |
6| /_____||_| |_| |_| |
7| |
8\---------------------------------------------------------------------*/
12#ifndef ZYPP_DEP_H
13#define ZYPP_DEP_H
14
15#include <zypp-core/Globals.h>
16#include <iosfwd>
17#include <string>
18
20namespace zypp
21{
22
24 //
25 // CLASS NAME : Dep
26 //
30 struct ZYPP_API Dep
31 {
32 friend bool operator==( const Dep & lhs, const Dep & rhs );
33 friend bool operator!=( const Dep & lhs, const Dep & rhs );
35 friend bool operator<( const Dep & lhs, const Dep & rhs );
36
43 static const Dep PROVIDES ZYPP_API;
44 static const Dep PREREQUIRES ZYPP_API;
45 static const Dep REQUIRES ZYPP_API;
46 static const Dep CONFLICTS ZYPP_API;
47 static const Dep OBSOLETES ZYPP_API;
48 static const Dep RECOMMENDS ZYPP_API;
49 static const Dep SUGGESTS ZYPP_API;
50 static const Dep ENHANCES ZYPP_API;
51 static const Dep SUPPLEMENTS ZYPP_API;
53
57 enum for_use_in_switch {
58 PROVIDES_e,
59 PREREQUIRES_e,
60 REQUIRES_e,
61 CONFLICTS_e,
62 OBSOLETES_e,
63 RECOMMENDS_e,
64 SUGGESTS_e,
65 ENHANCES_e,
66 SUPPLEMENTS_e,
67 };
68
76 explicit
77 Dep( const std::string & strval_r );
78
82 const std::string & asString() const ZYPP_API;
83
87 std::string asUserString() const ZYPP_API;
88
90 for_use_in_switch inSwitch() const
91 { return _type; }
92
93 private:
95 Dep( for_use_in_switch type_r )
96 : _type( type_r )
97 {}
98
99 for_use_in_switch _type;
100 };
101
102
104 inline std::ostream & operator<<( std::ostream & str, const Dep & obj )
105 { return str << obj.asString(); }
106
108
110 inline bool operator==( const Dep & lhs, const Dep & rhs )
111 { return lhs._type == rhs._type; }
112
114 inline bool operator!=( const Dep & lhs, const Dep & rhs )
115 { return lhs._type != rhs._type; }
116
118 inline bool operator<( const Dep & lhs, const Dep & rhs )
119 { return lhs._type < rhs._type; }
120
122} // namespace zypp
124#endif // ZYPP_DEP_H
Globals.h
Provides API related macros.
std
Definition ansi.h:855
str
String related utilities and Regular expression matching.
zypp
Easy-to use interface to the ZYPP dependency resolver.
Definition CodePitfalls.doc:2
zypp::asUserString
std::string asUserString(VendorSupportOption opt)
converts the support option to a name intended to be printed to the user.
Definition VendorSupportOptions.cc:9
zypp::ZYPP_API
const Arch Arch_empty ZYPP_API
relates: Arch This is an empty Arch represented by an empty string.
Definition Arch.h:173
zypp::asString
std::string asString(const Patch::Category &obj)
relates: Patch::Category string representation.
Definition Patch.cc:122
zypp::operator<<
std::ostream & operator<<(std::ostream &str, const Capabilities &obj)
relates: Capabilities Stream output
Definition Capabilities.cc:65
zypp::Dep
Enumeration class of dependency types.
Definition Dep.h:31
zypp::Dep::Dep
Dep(for_use_in_switch type_r)
Ctor to initialize the dependency type contants.
Definition Dep.h:95
zypp::Dep::ZYPP_API
static const Dep PROVIDES ZYPP_API
Definition Dep.h:43
zypp::Dep::for_use_in_switch
for_use_in_switch
Enumarators provided only for use inSwitch statement.
Definition Dep.h:57
zypp::Dep::SUGGESTS_e
@ SUGGESTS_e
Definition Dep.h:64
zypp::Dep::REQUIRES_e
@ REQUIRES_e
Definition Dep.h:60
zypp::Dep::PREREQUIRES_e
@ PREREQUIRES_e
Definition Dep.h:59
zypp::Dep::RECOMMENDS_e
@ RECOMMENDS_e
Definition Dep.h:63
zypp::Dep::SUPPLEMENTS_e
@ SUPPLEMENTS_e
Definition Dep.h:66
zypp::Dep::PROVIDES_e
@ PROVIDES_e
Definition Dep.h:58
zypp::Dep::CONFLICTS_e
@ CONFLICTS_e
Definition Dep.h:61
zypp::Dep::ENHANCES_e
@ ENHANCES_e
Definition Dep.h:65
zypp::Dep::OBSOLETES_e
@ OBSOLETES_e
Definition Dep.h:62
zypp::Dep::operator<
friend bool operator<(const Dep &lhs, const Dep &rhs)
Arbitrary order to allow Dep as key in std::container.
Definition Dep.h:118
zypp::Dep::_type
for_use_in_switch _type
The operator.
Definition Dep.h:99
zypp::Dep::inSwitch
for_use_in_switch inSwitch() const
Enumarator provided for use in switch statement.
Definition Dep.h:90
zypp::Dep::operator==
friend bool operator==(const Dep &lhs, const Dep &rhs)
relates: Dep
Definition Dep.h:110
zypp::Dep::asString
const std::string & asString() const ZYPP_API
String representation of dependency type.
Definition Dep.cc:76
zypp::Dep::operator!=
friend bool operator!=(const Dep &lhs, const Dep &rhs)
relates: Dep
Definition Dep.h:114
zypp::Dep::Dep
Dep(const std::string &strval_r)
Ctor from string.
Definition Dep.cc:67