Fawkes API
Fawkes Development Version
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
All
Classes
Namespaces
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Groups
Pages
string_compare.cpp
1
2
/***************************************************************************
3
* string_compare.cpp - Fawkes string compare utils
4
*
5
* Created: Fri May 11 23:40:28 2007
6
* Copyright 2006-2007 Tim Niemueller [www.niemueller.de]
7
*
8
****************************************************************************/
9
10
/* This program is free software; you can redistribute it and/or modify
11
* it under the terms of the GNU General Public License as published by
12
* the Free Software Foundation; either version 2 of the License, or
13
* (at your option) any later version. A runtime exception applies to
14
* this software (see LICENSE.GPL_WRE file mentioned below for details).
15
*
16
* This program is distributed in the hope that it will be useful,
17
* but WITHOUT ANY WARRANTY; without even the implied warranty of
18
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19
* GNU Library General Public License for more details.
20
*
21
* Read the full text in the LICENSE.GPL_WRE file in the doc directory.
22
*/
23
24
#include <utils/misc/string_compare.h>
25
#include <cstring>
26
27
namespace
fawkes {
28
29
/** @class StringEquality <utils/misc/string_compare.h>
30
* String equality checker.
31
* This is a valid binary predicate that can be used for instance hash maps
32
* as the equality predicate.
33
*
34
* The only method is used to check whether two supplied strings are equal.
35
* Uses strcmp for char arrays.
36
*
37
* @author Tim Niemueller
38
*/
39
40
/** Check equality of two strings.
41
* @param __s1 first string
42
* @param __s2 second string
43
* @return true, if the strings are equal, false otherwise
44
*/
45
bool
46
StringEquality::operator()
(
const
char
*__s1,
const
char
*__s2)
const
47
{
48
return
( strcmp(__s1, __s2) == 0 );
49
}
50
51
52
/** @class StringLess <utils/misc/string_compare.h>
53
* String less than test.
54
* This is a valid binary predicate that can be used for instance for maps
55
* as the less predicate.
56
*
57
* The only method is used to check whether one supplied strings is less
58
* then the other. Uses strcmp for char arrays.
59
*
60
* @author Tim Niemueller
61
*/
62
63
/** Check equality of two strings.
64
* @param __s1 first string
65
* @param __s2 second string
66
* @return true, if the __s1 < __s2
67
*/
68
bool
69
StringLess::operator()
(
const
char
*__s1,
const
char
*__s2)
const
70
{
71
return
( strcmp(__s1, __s2) < 0 );
72
}
73
74
75
}
// end namespace fawkes
src
libs
utils
misc
string_compare.cpp
Generated by
1.8.3.1