MCPcopy Create free account
hub / github.com/Redot-Engine/redot-engine / operator==

Method operator==

core/string/ustring.cpp:301–324  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

299}
300
301bool String::operator==(const char *p_str) const {
302 // compare Latin-1 encoded c-string
303 int len = strlen(p_str);
304
305 if (length() != len) {
306 return false;
307 }
308 if (is_empty()) {
309 return true;
310 }
311
312 int l = length();
313
314 const char32_t *dst = get_data();
315
316 // Compare char by char
317 for (int i = 0; i < l; i++) {
318 if ((char32_t)p_str[i] != dst[i]) {
319 return false;
320 }
321 }
322
323 return true;
324}
325
326bool String::operator==(const wchar_t *p_str) const {
327#ifdef WINDOWS_ENABLED

Callers

nothing calls this directly

Calls 5

strlenFunction · 0.85
get_dataFunction · 0.85
sizeMethod · 0.65
lengthMethod · 0.45
ptrMethod · 0.45

Tested by

no test coverage detected