fix linux side of semaphore abstraction
[ardour.git] / libs / pbd / pbd / stl_functors.h
1 /*
2     Copyright (C) 1998-99 Paul Barton-Davis
3  
4     This program is free software; you can redistribute it and/or modify
5     it under the terms of the GNU General Public License as published by
6     the Free Software Foundation; either version 2 of the License, or
7     (at your option) any later version.
8
9     This program is distributed in the hope that it will be useful,
10     but WITHOUT ANY WARRANTY; without even the implied warranty of
11     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12     GNU General Public License for more details.
13
14     You should have received a copy of the GNU General Public License
15     along with this program; if not, write to the Free Software
16     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
17
18 */
19
20 #ifndef __stl_functors_h__
21 #define __stl_functors_h__
22
23 #include <string>
24
25 #ifndef LESS_STRING_P
26 struct less<std::string *> {
27     bool operator()(std::string *s1, std::string *s2) const {
28       return *s1 < *s2;
29     }
30 };
31 #define LESS_STRING_P
32 #endif // LESS_STRING_P
33
34 #ifndef LESS_CONST_STRING_P
35 struct less<const std::string *> {
36     bool operator()(const std::string *s1, const std::string *s2) const {
37         return *s1 < *s2;
38     }
39 };
40 #define LESS_CONST_STRING_P
41 #endif // LESS_CONST_STRING_P
42
43 #ifndef LESS_CONST_CHAR_P
44 struct less<const char *>
45 {
46         bool operator()(const char* s1, const char* s2) const {
47                 return strcmp(s1, s2) < 0;
48         }
49 };
50 #define LESS_CONST_CHAR_P
51 #endif // LESS_CONST_CHAR_P
52
53 #ifndef LESS_CONST_FLOAT_P
54 struct less<const float *>
55 {
56         bool operator()(const float *n1, const float *n2) const {
57                 return *n1 < *n2;
58         }
59 };
60 #define LESS_CONST_FLOAT_P
61 #endif // LESS_CONST_FLOAT_P
62
63 #ifndef EQUAL_TO_CONST_CHAR_P
64 struct equal_to<const char *>
65 {
66         bool operator()(const char *s1, const char *s2) const {
67                 return strcmp (s1, s2) == 0;
68         }
69 };
70 #define EQUAL_TO_CONST_CHAR_P
71 #endif // EQUAL_TO_CONST_CHAR_P
72
73 #ifndef EQUAL_TO_STRING_P
74 struct equal_to<std::string *>
75 {
76         bool operator()(const std::string *s1, const std::string *s2) const {
77                 return *s1 == *s2;
78         }
79 };
80 #define EQUAL_TO_STRING_P
81 #endif // EQUAL_TO_STRING_P
82
83 #ifndef LESS_CONST_STRING_R
84 struct less<const std::string &> {
85     bool operator() (const std::string &s1, const std::string &s2) {
86             return s1 < s2; 
87     }
88 };
89 #define LESS_CONST_STRING_R
90 #endif // EQUAL_TO_STRING_P
91
92 #endif // __stl_functors_h__