MCPcopy Create free account
hub / github.com/BVLC/caffe / CaseInsensitiveWideCStringEquals

Method CaseInsensitiveWideCStringEquals

src/gtest/gtest-all.cpp:2919–2939  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

2917 // On MacOS X, it uses towlower, which also uses LC_CTYPE category of the
2918 // current locale.
2919bool String::CaseInsensitiveWideCStringEquals(const wchar_t* lhs,
2920 const wchar_t* rhs) {
2921 if (lhs == NULL) return rhs == NULL;
2922
2923 if (rhs == NULL) return false;
2924
2925#if GTEST_OS_WINDOWS
2926 return _wcsicmp(lhs, rhs) == 0;
2927#elif GTEST_OS_LINUX && !GTEST_OS_LINUX_ANDROID
2928 return wcscasecmp(lhs, rhs) == 0;
2929#else
2930 // Android, Mac OS X and Cygwin don't define wcscasecmp.
2931 // Other unknown OSes may not define it either.
2932 wint_t left, right;
2933 do {
2934 left = towlower(*lhs++);
2935 right = towlower(*rhs++);
2936 } while (left && left == right);
2937 return left == right;
2938#endif // OS selector
2939}
2940
2941// Compares this with another String.
2942// Returns < 0 if this is less than rhs, 0 if this is equal to rhs, or > 0

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected