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 environ
| 3415 | // On MacOS X, it uses towlower, which also uses LC_CTYPE category of the |
| 3416 | // current locale. |
| 3417 | bool String::CaseInsensitiveWideCStringEquals(const wchar_t* lhs, |
| 3418 | const wchar_t* rhs) { |
| 3419 | if (lhs == nullptr) return rhs == nullptr; |
| 3420 | |
| 3421 | if (rhs == nullptr) return false; |
| 3422 | |
| 3423 | #if GTEST_OS_WINDOWS |
| 3424 | return _wcsicmp(lhs, rhs) == 0; |
| 3425 | #elif GTEST_OS_LINUX && !GTEST_OS_LINUX_ANDROID |
| 3426 | return wcscasecmp(lhs, rhs) == 0; |
| 3427 | #else |
| 3428 | // Android, Mac OS X and Cygwin don't define wcscasecmp. |
| 3429 | // Other unknown OSes may not define it either. |
| 3430 | wint_t left, right; |
| 3431 | do { |
| 3432 | left = towlower(*lhs++); |
| 3433 | right = towlower(*rhs++); |
| 3434 | } while (left && left == right); |
| 3435 | return left == right; |
| 3436 | #endif // OS selector |
| 3437 | } |
| 3438 | |
| 3439 | // Returns true iff str ends with the given suffix, ignoring case. |
| 3440 | // Any string is considered to end with an empty suffix. |
nothing calls this directly
no outgoing calls
no test coverage detected