2009-02-03 19:08:07 +01:00
|
|
|
/* $Id$ */
|
|
|
|
|
2009-08-21 22:21:05 +02:00
|
|
|
/*
|
|
|
|
* This file is part of OpenTTD.
|
|
|
|
* OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
|
|
|
|
* OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
|
* See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
2009-02-03 19:08:07 +01:00
|
|
|
/** @file string_compare_type.hpp Comparator class for "const char *" so it can be used as a key for std::map */
|
|
|
|
|
|
|
|
#ifndef STRING_COMPARE_TYPE_HPP
|
|
|
|
#define STRING_COMPARE_TYPE_HPP
|
|
|
|
|
2011-05-02 19:42:12 +02:00
|
|
|
/** Comparator for strings. */
|
2009-02-03 19:08:07 +01:00
|
|
|
struct StringCompare {
|
2011-05-02 19:42:12 +02:00
|
|
|
/**
|
|
|
|
* Compare two strings.
|
|
|
|
* @param a The first string.
|
|
|
|
* @param b The second string.
|
|
|
|
* @return True is the first string is deemed "lower" than the second string.
|
|
|
|
*/
|
2009-02-03 19:08:07 +01:00
|
|
|
bool operator () (const char *a, const char *b) const
|
|
|
|
{
|
|
|
|
return strcmp(a, b) < 0;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif /* STRING_COMPARE_TYPE_HPP */
|