libzypp
11.13.5
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
libzypp
Welcome to libzypp
Code Pitfalls - Frequently made mistakes
Code Snippets
Environment Variables
Testing for provided features.
Notes on revisions
Extending ZYpp: Plugins and Hooks
Services
Solver - Vendor protection
Writing and tunning testcases
Libzypp and threads
Todo List
Deprecated List
Modules
Namespaces
Classes
Files
File List
zypp
base
media
misc
parser
pool
repo
sat
solver
target
thread
ui
url
ws
zypp_detail
APIConfig.h
Arch.cc
Arch.h
AutoDispose.h
Bit.h
ByteCount.cc
ByteCount.h
Callback.h
Capabilities.cc
Capabilities.h
Capability.cc
Capability.h
CapMatch.cc
CapMatch.h
Changelog.cc
Changelog.h
CheckSum.cc
CheckSum.h
CountryCode.cc
CountryCode.h
Date.cc
Date.h
Dep.cc
Dep.h
Digest.cc
Digest.h
DiskUsage.cc
DiskUsage.h
DiskUsageCounter.cc
DiskUsageCounter.h
DownloadMode.cc
DownloadMode.h
Edition.cc
Edition.h
ExternalProgram.cc
ExternalProgram.h
Fetcher.cc
Fetcher.h
FileChecker.cc
FileChecker.h
Filter.h
Glob.cc
Glob.h
HistoryLog.cc
HistoryLog.h
HistoryLogData.cc
HistoryLogData.h
IdString.cc
IdString.h
IdStringType.h
InstanceId.cc
InstanceId.h
KeyContext.h
KeyRing.cc
KeyRing.h
KVMap.h
LanguageCode.cc
LanguageCode.h
Locale.cc
Locale.h
Locks.cc
Locks.h
ManagedFile.h
MediaProducts.cc
MediaProducts.h
MediaSetAccess.cc
MediaSetAccess.h
Misc.h
OnMediaLocation.cc
OnMediaLocation.h
Package.cc
Package.h
PackageKeyword.h
Patch.cc
Patch.h
PathInfo.cc
PathInfo.h
Pathname.cc
Pathname.h
Pattern.cc
Pattern.h
PluginFrame.cc
PluginFrame.h
PluginFrameException.cc
PluginFrameException.h
PluginScript.cc
PluginScript.h
PluginScriptException.cc
PluginScriptException.h
PoolItem.cc
PoolItem.h
PoolItemBest.cc
PoolItemBest.h
PoolQuery.cc
PoolQuery.h
PoolQueryResult.cc
PoolQueryResult.h
PoolQueryUtil.tcc
ProblemSolution.cc
ProblemSolution.h
ProblemTypes.h
Product.cc
Product.h
ProgressData.cc
ProgressData.h
ProvideFilePolicy.cc
ProvideFilePolicy.h
PublicKey.cc
PublicKey.h
Range.cc
Range.h
Rel.cc
Rel.h
RelCompare.h
RepoInfo.cc
RepoInfo.h
RepoManager.cc
RepoManager.h
Repository.cc
Repository.h
RepoStatus.cc
RepoStatus.h
ResFilters.h
ResKind.cc
ResKind.h
ResObject.cc
ResObject.h
ResObjects.h
Resolvable.cc
Resolvable.h
Resolver.cc
Resolver.h
ResolverProblem.cc
ResolverProblem.h
ResPool.cc
ResPool.h
ResPoolProxy.cc
ResPoolProxy.h
ResStatus.cc
ResStatus.h
ResTraits.h
ServiceInfo.cc
ServiceInfo.h
Signature.cc
Signature.h
SrcPackage.cc
SrcPackage.h
SysContent.cc
SysContent.h
Target.cc
Target.h
TmpPath.cc
TmpPath.h
TriBool.h
Url.cc
Url.h
Vendor.h
VendorAttr.cc
VendorAttr.h
VendorSupportOptions.cc
VendorSupportOptions.h
ZConfig.cc
ZConfig.h
ZYpp.cc
ZYpp.h
ZYppCallbacks.h
ZYppCommit.h
ZYppCommitPolicy.cc
ZYppCommitPolicy.h
ZYppCommitResult.cc
ZYppCommitResult.h
ZYppFactory.cc
ZYppFactory.h
File Members
Range.cc
Go to the documentation of this file.
1
/*---------------------------------------------------------------------\
2
| ____ _ __ __ ___ |
3
| |__ / \ / / . \ . \ |
4
| / / \ V /| _/ _/ |
5
| / /__ | | | | | | |
6
| /_____||_| |_| |_| |
7
| |
8
\---------------------------------------------------------------------*/
12
#include <iostream>
13
//#include "zypp/base/Logger.h"
14
15
#include "
zypp/Range.h
"
16
17
using
std::endl;
18
20
namespace
zypp
21
{
22
23
namespace
range_detail
24
{
30
bool
overlaps
(
Rel
lhs,
Rel
rhs,
int
cmp )
31
{
32
if
( lhs ==
Rel::NONE
|| rhs ==
Rel::NONE
)
33
return
false
;
34
if
( lhs ==
Rel::ANY
|| rhs ==
Rel::ANY
)
35
return
true
;
36
37
if
( lhs ==
Rel::NE
)
38
{
39
if
( cmp < 0 )
40
{
41
// lhs < rhs
42
return
( rhs ==
Rel::GE
43
|| rhs ==
Rel::EQ
);
44
}
else
if
( cmp > 0)
45
{
46
// lhs > rhs
47
return
( rhs ==
Rel::LT
48
|| rhs ==
Rel::EQ
);
49
}
else
50
{
51
//lhs == rhs
52
return
( rhs ==
Rel::GT
53
|| rhs ==
Rel::LT
);
54
}
55
}
56
57
if
( rhs ==
Rel::NE
)
58
{
59
if
( cmp < 0 )
60
{
61
// lhs < rhs
62
return
( lhs ==
Rel::LE
63
|| lhs ==
Rel::EQ
);
64
}
else
if
( cmp > 0)
65
{
66
// lhs > rhs
67
return
( lhs ==
Rel::GT
68
|| lhs ==
Rel::EQ
);
69
}
else
70
{
71
//lhs == rhs
72
return
( lhs ==
Rel::GT
73
|| lhs ==
Rel::LT
);
74
}
75
}
76
77
if
( cmp < 0 )
78
{
79
// lhs < rhs: either lhs includes greater values or rhs includes lower.
80
return
( lhs ==
Rel::GT
81
|| lhs ==
Rel::GE
82
|| rhs ==
Rel::LT
83
|| rhs ==
Rel::LE
);
84
}
85
86
if
( cmp > 0 )
87
{
88
// lhs > rhs: either lhs includes lower values or rhs includes greater.
89
return
( lhs ==
Rel::LT
90
|| lhs ==
Rel::LE
91
|| rhs ==
Rel::GT
92
|| rhs ==
Rel::GE
);
93
}
94
95
// lhs == rhs: either both ranges include Rel::EQ, or both head
96
// into the same direction.
97
if
( ( lhs ==
Rel::LE
|| lhs ==
Rel::EQ
|| lhs ==
Rel::GE
)
98
&& ( rhs ==
Rel::LE
|| rhs ==
Rel::EQ
|| rhs ==
Rel::GE
) )
99
return
true
;
100
if
( ( lhs ==
Rel::LT
&& ( rhs ==
Rel::LT
|| rhs ==
Rel::LE
) )
101
|| ( lhs ==
Rel::GT
&& ( rhs ==
Rel::GT
|| rhs ==
Rel::GE
) )
102
|| ( rhs ==
Rel::LT
&& ( lhs ==
Rel::LT
|| lhs ==
Rel::LE
) )
103
|| ( rhs ==
Rel::GT
&& ( lhs ==
Rel::GT
|| lhs ==
Rel::GE
) ) )
104
return
true
;
105
// else
106
return
false
;
107
108
}
109
}
110
111
113
}
// namespace zypp
zypp
Range.cc
Generated by
1.8.1