Cross Reference: ord.h
xref
: /
inkscape
/
src
/
2geom
/
ord.h
Home
History
Annotate
Line#
Navigate
Download
Search
only in
./
ord.h revision 182486105ac34c36a2c74e775bcb44d5cbbaffac
29684a16b6c92bee28a94fdc2607bcc143950fa8
johanengelen
29684a16b6c92bee28a94fdc2607bcc143950fa8
johanengelen
#
ifndef
__2GEOM_ORD__
29684a16b6c92bee28a94fdc2607bcc143950fa8
johanengelen
#
define
__2GEOM_ORD__
29684a16b6c92bee28a94fdc2607bcc143950fa8
johanengelen
29684a16b6c92bee28a94fdc2607bcc143950fa8
johanengelen
namespace
{
29684a16b6c92bee28a94fdc2607bcc143950fa8
johanengelen
182486105ac34c36a2c74e775bcb44d5cbbaffac
joncruz
enum
Cmp
{
182486105ac34c36a2c74e775bcb44d5cbbaffac
joncruz
LESS_THAN
=-
1
,
182486105ac34c36a2c74e775bcb44d5cbbaffac
joncruz
GREATER_THAN
=
1
,
182486105ac34c36a2c74e775bcb44d5cbbaffac
joncruz
EQUAL_TO
=0
182486105ac34c36a2c74e775bcb44d5cbbaffac
joncruz
};
29684a16b6c92bee28a94fdc2607bcc143950fa8
johanengelen
29684a16b6c92bee28a94fdc2607bcc143950fa8
johanengelen
inline
Cmp
operator
-(
Cmp
x) {
29684a16b6c92bee28a94fdc2607bcc143950fa8
johanengelen
switch
(x) {
29684a16b6c92bee28a94fdc2607bcc143950fa8
johanengelen
case
LESS_THAN
:
29684a16b6c92bee28a94fdc2607bcc143950fa8
johanengelen
return
GREATER_THAN
;
29684a16b6c92bee28a94fdc2607bcc143950fa8
johanengelen
case
GREATER_THAN
:
29684a16b6c92bee28a94fdc2607bcc143950fa8
johanengelen
return
LESS_THAN
;
29684a16b6c92bee28a94fdc2607bcc143950fa8
johanengelen
case
EQUAL_TO
:
29684a16b6c92bee28a94fdc2607bcc143950fa8
johanengelen
return
EQUAL_TO
;
29684a16b6c92bee28a94fdc2607bcc143950fa8
johanengelen
}
29684a16b6c92bee28a94fdc2607bcc143950fa8
johanengelen
}
182486105ac34c36a2c74e775bcb44d5cbbaffac
joncruz
182486105ac34c36a2c74e775bcb44d5cbbaffac
joncruz
template
<
typename
T1
,
typename
T2
>
182486105ac34c36a2c74e775bcb44d5cbbaffac
joncruz
inline
Cmp
cmp
(
T1
const
&a,
T2
const
&b) {
182486105ac34c36a2c74e775bcb44d5cbbaffac
joncruz
if
( a < b ) {
182486105ac34c36a2c74e775bcb44d5cbbaffac
joncruz
return
LESS_THAN
;
182486105ac34c36a2c74e775bcb44d5cbbaffac
joncruz
}
else
if
( b < a ) {
182486105ac34c36a2c74e775bcb44d5cbbaffac
joncruz
return
GREATER_THAN
;
182486105ac34c36a2c74e775bcb44d5cbbaffac
joncruz
}
else
{
182486105ac34c36a2c74e775bcb44d5cbbaffac
joncruz
return
EQUAL_TO
;
182486105ac34c36a2c74e775bcb44d5cbbaffac
joncruz
}
29684a16b6c92bee28a94fdc2607bcc143950fa8
johanengelen
}
29684a16b6c92bee28a94fdc2607bcc143950fa8
johanengelen
29684a16b6c92bee28a94fdc2607bcc143950fa8
johanengelen
}
29684a16b6c92bee28a94fdc2607bcc143950fa8
johanengelen
29684a16b6c92bee28a94fdc2607bcc143950fa8
johanengelen
#
endif