rollback to 3428, before the mysterious removal of libs/* at 3431/3432
[ardour.git] / libs / glibmm2 / tools / m4 / compare.m4
1 dnl $Id: compare.m4 58 2003-12-14 11:53:04Z murrayc $
2
3 define(`__OPERATOR_DECL',`dnl
4 /** @relates __NAMESPACE__::__CPPNAME__
5  * @param lhs The left-hand side
6  * @param rhs The right-hand side
7  * @result The result
8  */
9 bool operator`'$1`'(const __CPPNAME__& lhs, const __CPPNAME__& rhs);
10 ')
11
12 define(`__OPERATOR_IMPL',`dnl
13 bool operator`'$1`'(const __CPPNAME__& lhs, const __CPPNAME__& rhs)
14 {'
15 ifelse`'(`__UNCONST__',`unconst',`dnl
16   return ($2`'(const_cast<__CNAME__*>(lhs.gobj()), const_cast<__CNAME__*>(rhs.gobj())) $3);
17 ',`dnl else
18   return ($2`'(lhs.gobj(), rhs.gobj()) $3);
19 ')`dnl endif
20 }
21 ')
22
23
24 dnl
25 dnl _WRAP_EQUAL(gdk_region_equal, unconst)
26 dnl
27 define(`_WRAP_EQUAL',`dnl
28 pushdef(`__FUNC_EQUAL__',$1)dnl
29 pushdef(`__UNCONST__',$2)dnl
30 _PUSH(SECTION_HEADER3)
31
32 __NAMESPACE_BEGIN__
33
34 __OPERATOR_DECL(`==')
35 __OPERATOR_DECL(`!=')
36
37 __NAMESPACE_END__
38
39 _SECTION(SECTION_CC)
40
41 __OPERATOR_IMPL(`==', __FUNC_EQUAL__, `!= 0')
42 __OPERATOR_IMPL(`!=', __FUNC_EQUAL__, `== 0')
43
44 _POP()
45 popdef(`__UNCONST__')dnl
46 popdef(`__FUNC_EQUAL__')dnl
47 ')dnl enddef _WRAP_EQUAL
48
49
50 dnl
51 dnl _WRAP_COMPARE(gtk_tree_path_compare)
52 dnl
53 define(`_WRAP_COMPARE',`dnl
54 pushdef(`__FUNC_COMPARE__',$1)dnl
55 pushdef(`__UNCONST__',$2)dnl
56 _PUSH(SECTION_HEADER3)
57
58 __NAMESPACE_BEGIN__
59
60 __OPERATOR_DECL(`==')
61 __OPERATOR_DECL(`!=')
62 __OPERATOR_DECL(`<')
63 __OPERATOR_DECL(`>')
64 __OPERATOR_DECL(`<=')
65 __OPERATOR_DECL(`>=')
66
67 __NAMESPACE_END__
68
69 _SECTION(SECTION_CC)
70
71 __OPERATOR_IMPL(`==', __FUNC_COMPARE__, `== 0')
72 __OPERATOR_IMPL(`!=', __FUNC_COMPARE__, `!= 0')
73 __OPERATOR_IMPL(`<', __FUNC_COMPARE__, `< 0')
74 __OPERATOR_IMPL(`>', __FUNC_COMPARE__, `> 0')
75 __OPERATOR_IMPL(`<=', __FUNC_COMPARE__, `<= 0')
76 __OPERATOR_IMPL(`>=', __FUNC_COMPARE__, `>= 0')
77
78 _POP()
79 popdef(`__UNCONST__')dnl
80 popdef(`__FUNC_COMPARE__')dnl
81 ')dnl enddef _WRAP_COMPARE
82
83
84 dnl
85 dnl _WRAP_EQUAL_AND_COMPARE(gtk_text_iter_equal, gtk_text_iter_compare)
86 dnl
87 define(`_WRAP_EQUAL_AND_COMPARE',`dnl
88 pushdef(`__FUNC_EQUAL__',$1)dnl
89 pushdef(`__FUNC_COMPARE__',$2)dnl
90 pushdef(`__UNCONST__',$3)dnl
91 _PUSH(SECTION_HEADER3)
92
93 __NAMESPACE_BEGIN__
94
95 __OPERATOR_DECL(`==')
96 __OPERATOR_DECL(`!=')
97 __OPERATOR_DECL(`<')
98 __OPERATOR_DECL(`>')
99 __OPERATOR_DECL(`<=')
100 __OPERATOR_DECL(`>=')
101
102 __NAMESPACE_END__
103
104 _SECTION(SECTION_CC)
105
106 __OPERATOR_IMPL(`==', __FUNC_EQUAL__, `!= 0')
107 __OPERATOR_IMPL(`!=', __FUNC_EQUAL__, `== 0')
108 __OPERATOR_IMPL(`<', __FUNC_COMPARE__, `< 0')
109 __OPERATOR_IMPL(`>', __FUNC_COMPARE__, `> 0')
110 __OPERATOR_IMPL(`<=', __FUNC_COMPARE__, `<= 0')
111 __OPERATOR_IMPL(`>=', __FUNC_COMPARE__, `>= 0')
112
113 _POP()
114 popdef(`__UNCONST__')dnl
115 popdef(`__FUNC_COMPARE__')dnl
116 popdef(`__FUNC_EQUAL__')dnl
117 ')dnl enddef _WRAP_EQUAL_AND_COMPARE
118