aboutsummaryrefslogtreecommitdiff
path: root/include/gtest/internal/gtest-string.h
diff options
context:
space:
mode:
authorshiqian <shiqian@861a406c-534a-0410-8894-cb66d6ee9925>2008-09-08 17:55:52 +0000
committershiqian <shiqian@861a406c-534a-0410-8894-cb66d6ee9925>2008-09-08 17:55:52 +0000
commite8ff148b4309e115da1c55089dc3b9a241a928dc (patch)
treea4f4a88d89b4f957655a479bba3f33908572fcb5 /include/gtest/internal/gtest-string.h
parente006e686a4230b548709d6ba2d42bfdf4f9f1638 (diff)
downloadgtest-e8ff148b4309e115da1c55089dc3b9a241a928dc.tar.gz
Adds support for type-parameterized tests (by Zhanyong Wan); also adds case-insensitive wide string comparison to the String class (by Vlad Losev).
git-svn-id: http://googletest.googlecode.com/svn/trunk@84 861a406c-534a-0410-8894-cb66d6ee9925
Diffstat (limited to 'include/gtest/internal/gtest-string.h')
-rw-r--r--include/gtest/internal/gtest-string.h19
1 files changed, 19 insertions, 0 deletions
diff --git a/include/gtest/internal/gtest-string.h b/include/gtest/internal/gtest-string.h
index 612b6ce..b37ff4f 100644
--- a/include/gtest/internal/gtest-string.h
+++ b/include/gtest/internal/gtest-string.h
@@ -167,6 +167,21 @@ class String {
static bool CaseInsensitiveCStringEquals(const char* lhs,
const char* rhs);
+ // Compares two wide C strings, ignoring case. Returns true iff they
+ // have the same content.
+ //
+ // Unlike wcscasecmp(), this function can handle NULL argument(s).
+ // A NULL C string is considered different to any non-NULL wide C string,
+ // including the empty string.
+ // NB: The implementations on different platforms slightly differ.
+ // On windows, this method uses _wcsicmp which compares according to LC_CTYPE
+ // environment variable. On GNU platform this method uses wcscasecmp
+ // which compares according to LC_CTYPE category of the current locale.
+ // On MacOS X, it uses towlower, which also uses LC_CTYPE category of the
+ // current locale.
+ static bool CaseInsensitiveWideCStringEquals(const wchar_t* lhs,
+ const wchar_t* rhs);
+
// Formats a list of arguments to a String, using the same format
// spec string as for printf.
//
@@ -218,6 +233,10 @@ class String {
return CStringEquals(c_str_, c_str);
}
+ // Returns true iff this String is less than the given C string. A NULL
+ // string is considered less than "".
+ bool operator<(const String& rhs) const { return Compare(rhs) < 0; }
+
// Returns true iff this String doesn't equal the given C string. A NULL
// string and a non-NULL string are considered not equal.
bool operator!=(const char* c_str) const {