MCPcopy Create free account
hub / github.com/SakuraEngine/SakuraEngine / copy_from

Method copy_from

modules/gui/gui/src/backend/text_server/ustring.cpp:145–170  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

143}
144
145void Char16String::copy_from(const char16_t* p_cstr)
146{
147 if (!p_cstr)
148 {
149 resize(0);
150 return;
151 }
152
153 const char16_t* s = p_cstr;
154 for (; *s; s++)
155 {
156 }
157 size_t len = s - p_cstr;
158
159 if (len == 0)
160 {
161 resize(0);
162 return;
163 }
164
165 Error err = resize(++len); // include terminating null char
166
167 ERR_FAIL_COND_MSG(err != OK, "Failed to copy char16_t string.");
168
169 memcpy(ptrw(), p_cstr, len * sizeof(char16_t));
170}
171
172/*************************************************************************/
173/* CharString */

Callers

nothing calls this directly

Calls 3

ptrwMethod · 0.95
memcpyFunction · 0.85
resizeFunction · 0.50

Tested by

no test coverage detected