use right-side buttons to goto_nth_marker()
[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 #include "pbd/libpbd_visibility.h"
26
27 #ifndef LESS_STRING_P
28 struct LIBPBD_API less<std::string *> {
29     bool operator()(std::string *s1, std::string *s2) const {
30       return *s1 < *s2;
31     }
32 };
33 #define LESS_STRING_P
34 #endif // LESS_STRING_P
35
36 #ifndef LESS_CONST_STRING_P
37 struct LIBPBD_API less<const std::string *> {
38     bool operator()(const std::string *s1, const std::string *s2) const {
39         return *s1 < *s2;
40     }
41 };
42 #define LESS_CONST_STRING_P
43 #endif // LESS_CONST_STRING_P
44
45 #ifndef LESS_CONST_CHAR_P
46 struct LIBPBD_API less<const char *>
47 {
48         bool operator()(const char* s1, const char* s2) const {
49                 return strcmp(s1, s2) < 0;
50         }
51 };
52 #define LESS_CONST_CHAR_P
53 #endif // LESS_CONST_CHAR_P
54
55 #ifndef LESS_CONST_FLOAT_P
56 struct LIBPBD_API less<const float *>
57 {
58         bool operator()(const float *n1, const float *n2) const {
59                 return *n1 < *n2;
60         }
61 };
62 #define LESS_CONST_FLOAT_P
63 #endif // LESS_CONST_FLOAT_P
64
65 #ifndef EQUAL_TO_CONST_CHAR_P
66 struct LIBPBD_API equal_to<const char *>
67 {
68         bool operator()(const char *s1, const char *s2) const {
69                 return strcmp (s1, s2) == 0;
70         }
71 };
72 #define EQUAL_TO_CONST_CHAR_P
73 #endif // EQUAL_TO_CONST_CHAR_P
74
75 #ifndef EQUAL_TO_STRING_P
76 struct LIBPBD_API equal_to<std::string *>
77 {
78         bool operator()(const std::string *s1, const std::string *s2) const {
79                 return *s1 == *s2;
80         }
81 };
82 #define EQUAL_TO_STRING_P
83 #endif // EQUAL_TO_STRING_P
84
85 #ifndef LESS_CONST_STRING_R
86 struct LIBPBD_API less<const std::string &> {
87     bool operator() (const std::string &s1, const std::string &s2) {
88             return s1 < s2;
89     }
90 };
91 #define LESS_CONST_STRING_R
92 #endif // EQUAL_TO_STRING_P
93
94 #endif // __stl_functors_h__