diff options
author | tfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-11-03 03:53:35 +0000 |
---|---|---|
committer | tfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-11-03 03:53:35 +0000 |
commit | 07f1ceeabc0cf63ed8d7ae7aa8d1ff04dda02584 (patch) | |
tree | 0fa72c2ed2d771f492a2ec068d3137722220cbc5 /base/string_util.h | |
parent | d019f6ef8b3e225cb912291e5aebf9a295f42a23 (diff) | |
download | chromium_src-07f1ceeabc0cf63ed8d7ae7aa8d1ff04dda02584.zip chromium_src-07f1ceeabc0cf63ed8d7ae7aa8d1ff04dda02584.tar.gz chromium_src-07f1ceeabc0cf63ed8d7ae7aa8d1ff04dda02584.tar.bz2 |
base: Move CaseInsensitiveCompare traits into the base namespace.
This should fix conflicts like:
2>d:\src\chromium_src2\src\base/string_util.h(480) : error C2904: 'CaseInsensitiveCompare' : name already used for a template in the current scope
2> d:\src\chromium_src2\src\third_party\xulrunner-sdk\win\include\xpcom\nsStringAPI.h(1406) : see declaration of 'CaseInsensitiveCompare'
Reported-by: Jeff Timanus <twiz@google.com>
BUG=None
TEST=trybots
Review URL: http://codereview.chromium.org/4366001
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@64877 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/string_util.h')
-rw-r--r-- | base/string_util.h | 35 |
1 files changed, 18 insertions, 17 deletions
diff --git a/base/string_util.h b/base/string_util.h index 27de472..186679e 100644 --- a/base/string_util.h +++ b/base/string_util.h @@ -116,6 +116,24 @@ size_t wcslcpy(wchar_t* dst, const wchar_t* src, size_t dst_size); // This function is intended to be called from base::vswprintf. bool IsWprintfFormatPortable(const wchar_t* format); +// Function objects to aid in comparing/searching strings. + +template<typename Char> struct CaseInsensitiveCompare { + public: + bool operator()(Char x, Char y) const { + // TODO(darin): Do we really want to do locale sensitive comparisons here? + // See http://crbug.com/24917 + return tolower(x) == tolower(y); + } +}; + +template<typename Char> struct CaseInsensitiveCompareASCII { + public: + bool operator()(Char x, Char y) const { + return ToLowerASCII(x) == ToLowerASCII(y); + } +}; + } // namespace base #if defined(OS_WIN) @@ -468,23 +486,6 @@ inline typename string_type::value_type* WriteInto(string_type* str, //----------------------------------------------------------------------------- -// Function objects to aid in comparing/searching strings. - -template<typename Char> struct CaseInsensitiveCompare { - public: - bool operator()(Char x, Char y) const { - // TODO(darin): Do we really want to do locale sensitive comparisons here? - // See http://crbug.com/24917 - return tolower(x) == tolower(y); - } -}; - -template<typename Char> struct CaseInsensitiveCompareASCII { - public: - bool operator()(Char x, Char y) const { - return ToLowerASCII(x) == ToLowerASCII(y); - } -}; // Splits a string into its fields delimited by any of the characters in // |delimiters|. Each field is added to the |tokens| vector. Returns the |