remove UUIDs as implemention of PBD::ID, use static counter (not finished - counter...
[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     $Id$
19 */
20
21 #ifndef __stl_functors_h__
22 #define __stl_functors_h__
23
24 #include <string>
25
26 #ifndef LESS_STRING_P
27 struct less<std::string *> {
28     bool operator()(std::string *s1, std::string *s2) const {
29       return *s1 < *s2;
30     }
31 };
32 #define LESS_STRING_P
33 #endif // LESS_STRING_P
34
35 #ifndef LESS_CONST_STRING_P
36 struct less<const std::string *> {
37     bool operator()(const std::string *s1, const std::string *s2) const {
38         return *s1 < *s2;
39     }
40 };
41 #define LESS_CONST_STRING_P
42 #endif // LESS_CONST_STRING_P
43
44 #ifndef LESS_CONST_CHAR_P
45 struct less<const char *>
46 {
47         bool operator()(const char* s1, const char* s2) const {
48                 return strcmp(s1, s2) < 0;
49         }
50 };
51 #define LESS_CONST_CHAR_P
52 #endif // LESS_CONST_CHAR_P
53
54 #ifndef LESS_CONST_FLOAT_P
55 struct less<const float *>
56 {
57         bool operator()(const float *n1, const float *n2) const {
58                 return *n1 < *n2;
59         }
60 };
61 #define LESS_CONST_FLOAT_P
62 #endif // LESS_CONST_FLOAT_P
63
64 #ifndef EQUAL_TO_CONST_CHAR_P
65 struct equal_to<const char *>
66 {
67         bool operator()(const char *s1, const char *s2) const {
68                 return strcmp (s1, s2) == 0;
69         }
70 };
71 #define EQUAL_TO_CONST_CHAR_P
72 #endif // EQUAL_TO_CONST_CHAR_P
73
74 #ifndef EQUAL_TO_STRING_P
75 struct equal_to<std::string *>
76 {
77         bool operator()(const std::string *s1, const std::string *s2) const {
78                 return *s1 == *s2;
79         }
80 };
81 #define EQUAL_TO_STRING_P
82 #endif // EQUAL_TO_STRING_P
83
84 #ifndef LESS_CONST_STRING_R
85 struct less<const std::string &> {
86     bool operator() (const std::string &s1, const std::string &s2) {
87             return s1 < s2; 
88     }
89 };
90 #define LESS_CONST_STRING_R
91 #endif // EQUAL_TO_STRING_P
92
93 #endif // __stl_functors_h__