1
/*---------------------------------------------------------------------\
3
| |__ / \ / / . \ . \ |
8
\---------------------------------------------------------------------*/
9
/** \file zypp/Range.cc
13
//#include "zypp/base/Logger.h"
15
#include "zypp/Range.h"
19
///////////////////////////////////////////////////////////////////
21
{ /////////////////////////////////////////////////////////////////
23
namespace range_detail
25
/** Compute Range overlaps.
26
* Takes the \a lhs and \a rhs operator and the result
27
* of comparing \a lhs and \a rhs (<tt>-1,0,1</tt>).
30
bool overlaps( Rel lhs, Rel rhs, int cmp )
32
if ( lhs == Rel::NONE || rhs == Rel::NONE )
34
if ( lhs == Rel::ANY || rhs == Rel::ANY )
42
return( rhs == Rel::GE
47
return( rhs == Rel::LT
52
return ( rhs == Rel::GT
62
return( lhs == Rel::LE
67
return( lhs == Rel::GT
72
return ( lhs == Rel::GT
79
// lhs < rhs: either lhs includes greater values or rhs includes lower.
80
return( lhs == Rel::GT
88
// lhs > rhs: either lhs includes lower values or rhs includes greater.
89
return( lhs == Rel::LT
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 ) )
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 ) ) )
112
/////////////////////////////////////////////////////////////////
114
///////////////////////////////////////////////////////////////////