Rename String::resize to resize_uninitialized, to better communicate to callers that new characters must be initialized.
This commit is contained in:
parent
51b0379e55
commit
b13a0e1834
26 changed files with 103 additions and 98 deletions
|
|
@ -82,20 +82,20 @@ void OptimizedTranslation::generate(const Ref<Translation> &p_from) {
|
|||
|
||||
if (ps.orig_len != 0) {
|
||||
CharString dst_s;
|
||||
dst_s.resize(src_s.size());
|
||||
dst_s.resize_uninitialized(src_s.size());
|
||||
int ret = smaz_compress(src_s.get_data(), src_s.size(), dst_s.ptrw(), src_s.size());
|
||||
if (ret >= src_s.size()) {
|
||||
//if compressed is larger than original, just use original
|
||||
ps.orig_len = src_s.size();
|
||||
ps.compressed = src_s;
|
||||
} else {
|
||||
dst_s.resize(ret);
|
||||
dst_s.resize_uninitialized(ret);
|
||||
//ps.orig_len=;
|
||||
ps.compressed = dst_s;
|
||||
}
|
||||
} else {
|
||||
ps.orig_len = 1;
|
||||
ps.compressed.resize(1);
|
||||
ps.compressed.resize_uninitialized(1);
|
||||
ps.compressed[0] = 0;
|
||||
}
|
||||
|
||||
|
|
@ -256,7 +256,7 @@ StringName OptimizedTranslation::get_message(const StringName &p_src_text, const
|
|||
return String::utf8(&sptr[bucket.elem[idx].str_offset], bucket.elem[idx].uncomp_size);
|
||||
} else {
|
||||
CharString uncomp;
|
||||
uncomp.resize(bucket.elem[idx].uncomp_size + 1);
|
||||
uncomp.resize_uninitialized(bucket.elem[idx].uncomp_size + 1);
|
||||
smaz_decompress(&sptr[bucket.elem[idx].str_offset], bucket.elem[idx].comp_size, uncomp.ptrw(), bucket.elem[idx].uncomp_size);
|
||||
return String::utf8(uncomp.get_data());
|
||||
}
|
||||
|
|
@ -282,7 +282,7 @@ Vector<String> OptimizedTranslation::get_translated_message_list() const {
|
|||
msgs.push_back(rstr);
|
||||
} else {
|
||||
CharString uncomp;
|
||||
uncomp.resize(bucket.elem[j].uncomp_size + 1);
|
||||
uncomp.resize_uninitialized(bucket.elem[j].uncomp_size + 1);
|
||||
smaz_decompress(&sptr[bucket.elem[j].str_offset], bucket.elem[j].comp_size, uncomp.ptrw(), bucket.elem[j].uncomp_size);
|
||||
String rstr = String::utf8(uncomp.get_data());
|
||||
msgs.push_back(rstr);
|
||||
|
|
|
|||
|
|
@ -123,7 +123,7 @@ StringBuffer<SHORT_BUFFER_SIZE> &StringBuffer<SHORT_BUFFER_SIZE>::reserve(int p_
|
|||
}
|
||||
|
||||
bool need_copy = string_length > 0 && buffer.is_empty();
|
||||
buffer.resize(next_power_of_2((uint32_t)p_size));
|
||||
buffer.resize_uninitialized(next_power_of_2((uint32_t)p_size));
|
||||
if (need_copy) {
|
||||
memcpy(buffer.ptrw(), short_buffer, string_length * sizeof(char32_t));
|
||||
}
|
||||
|
|
@ -142,7 +142,7 @@ String StringBuffer<SHORT_BUFFER_SIZE>::as_string() {
|
|||
if (buffer.is_empty()) {
|
||||
return String(short_buffer);
|
||||
} else {
|
||||
buffer.resize(string_length + 1);
|
||||
buffer.resize_uninitialized(string_length + 1);
|
||||
return buffer;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -60,7 +60,7 @@ String StringBuilder::as_string() const {
|
|||
}
|
||||
|
||||
String string;
|
||||
string.resize(string_length + 1);
|
||||
string.resize_uninitialized(string_length + 1);
|
||||
char32_t *buffer = string.ptrw();
|
||||
|
||||
int current_position = 0;
|
||||
|
|
|
|||
|
|
@ -175,7 +175,7 @@ void String::append_latin1(const Span<char> &p_cstr) {
|
|||
}
|
||||
|
||||
const int prev_length = length();
|
||||
resize(prev_length + p_cstr.size() + 1); // include 0
|
||||
resize_uninitialized(prev_length + p_cstr.size() + 1); // include 0
|
||||
|
||||
const char *src = p_cstr.ptr();
|
||||
const char *end = src + p_cstr.size();
|
||||
|
|
@ -194,7 +194,7 @@ void String::append_utf32(const Span<char32_t> &p_cstr) {
|
|||
}
|
||||
|
||||
const int prev_length = length();
|
||||
resize(prev_length + p_cstr.size() + 1);
|
||||
resize_uninitialized(prev_length + p_cstr.size() + 1);
|
||||
const char32_t *src = p_cstr.ptr();
|
||||
const char32_t *end = p_cstr.ptr() + p_cstr.size();
|
||||
char32_t *dst = ptrw() + prev_length;
|
||||
|
|
@ -223,7 +223,7 @@ void String::append_utf32(const Span<char32_t> &p_cstr) {
|
|||
// p_length <= p_char strlen
|
||||
// p_char is a valid UTF32 string
|
||||
void String::copy_from_unchecked(const char32_t *p_char, const int p_length) {
|
||||
resize(p_length + 1); // + 1 for \0
|
||||
resize_uninitialized(p_length + 1); // + 1 for \0
|
||||
char32_t *dst = ptrw();
|
||||
memcpy(dst, p_char, p_length * sizeof(char32_t));
|
||||
*(dst + p_length) = _null;
|
||||
|
|
@ -1365,7 +1365,7 @@ String String::join(const Vector<String> &parts) const {
|
|||
new_size += 1;
|
||||
|
||||
String ret;
|
||||
ret.resize(new_size);
|
||||
ret.resize_uninitialized(new_size);
|
||||
char32_t *ret_ptrw = ret.ptrw();
|
||||
const char32_t *this_ptr = ptr();
|
||||
|
||||
|
|
@ -1404,7 +1404,7 @@ String String::to_upper() const {
|
|||
}
|
||||
|
||||
String upper;
|
||||
upper.resize(size());
|
||||
upper.resize_uninitialized(size());
|
||||
const char32_t *old_ptr = ptr();
|
||||
char32_t *upper_ptrw = upper.ptrw();
|
||||
|
||||
|
|
@ -1423,7 +1423,7 @@ String String::to_lower() const {
|
|||
}
|
||||
|
||||
String lower;
|
||||
lower.resize(size());
|
||||
lower.resize_uninitialized(size());
|
||||
const char32_t *old_ptr = ptr();
|
||||
char32_t *lower_ptrw = lower.ptrw();
|
||||
|
||||
|
|
@ -1549,7 +1549,7 @@ String String::num_int64(int64_t p_num, int base, bool capitalize_hex) {
|
|||
chars++;
|
||||
}
|
||||
String s;
|
||||
s.resize(chars + 1);
|
||||
s.resize_uninitialized(chars + 1);
|
||||
char32_t *c = s.ptrw();
|
||||
c[chars] = 0;
|
||||
n = p_num;
|
||||
|
|
@ -1584,7 +1584,7 @@ String String::num_uint64(uint64_t p_num, int base, bool capitalize_hex) {
|
|||
} while (n);
|
||||
|
||||
String s;
|
||||
s.resize(chars + 1);
|
||||
s.resize_uninitialized(chars + 1);
|
||||
char32_t *c = s.ptrw();
|
||||
c[chars] = 0;
|
||||
n = p_num;
|
||||
|
|
@ -1675,7 +1675,7 @@ String String::hex_encode_buffer(const uint8_t *p_buffer, int p_len) {
|
|||
static const char hex[16] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f' };
|
||||
|
||||
String ret;
|
||||
ret.resize(p_len * 2 + 1);
|
||||
ret.resize_uninitialized(p_len * 2 + 1);
|
||||
char32_t *ret_ptrw = ret.ptrw();
|
||||
|
||||
for (int i = 0; i < p_len; i++) {
|
||||
|
|
@ -1706,7 +1706,7 @@ Vector<uint8_t> String::hex_decode() const {
|
|||
|
||||
Vector<uint8_t> out;
|
||||
int len = length() / 2;
|
||||
out.resize(len);
|
||||
out.resize_uninitialized(len);
|
||||
uint8_t *out_ptrw = out.ptrw();
|
||||
for (int i = 0; i < len; i++) {
|
||||
char32_t c;
|
||||
|
|
@ -1732,7 +1732,7 @@ CharString String::ascii(bool p_allow_extended) const {
|
|||
}
|
||||
|
||||
CharString cs;
|
||||
cs.resize(size());
|
||||
cs.resize_uninitialized(size());
|
||||
char *cs_ptrw = cs.ptrw();
|
||||
const char32_t *this_ptr = ptr();
|
||||
|
||||
|
|
@ -1755,7 +1755,7 @@ Error String::append_ascii(const Span<char> &p_range) {
|
|||
}
|
||||
|
||||
const int prev_length = length();
|
||||
resize(prev_length + p_range.size() + 1); // Include \0
|
||||
resize_uninitialized(prev_length + p_range.size() + 1); // Include \0
|
||||
|
||||
const char *src = p_range.ptr();
|
||||
const char *end = src + p_range.size();
|
||||
|
|
@ -1800,7 +1800,7 @@ Error String::append_utf8(const char *p_utf8, int p_len, bool p_skip_cr) {
|
|||
|
||||
const int prev_length = length();
|
||||
// If all utf8 characters maps to ASCII, then the max size will be p_len, and we add +1 for the null termination.
|
||||
resize(prev_length + p_len + 1);
|
||||
resize_uninitialized(prev_length + p_len + 1);
|
||||
char32_t *dst = ptrw() + prev_length;
|
||||
|
||||
Error result = Error::OK;
|
||||
|
|
@ -1946,7 +1946,7 @@ Error String::append_utf8(const char *p_utf8, int p_len, bool p_skip_cr) {
|
|||
}
|
||||
|
||||
(*dst++) = 0;
|
||||
resize(prev_length + dst - ptr());
|
||||
resize_uninitialized(prev_length + dst - ptr());
|
||||
|
||||
return result;
|
||||
}
|
||||
|
|
@ -1959,7 +1959,7 @@ CharString String::utf8(Vector<uint8_t> *r_ch_length_map) const {
|
|||
|
||||
uint8_t *map_ptr = nullptr;
|
||||
if (r_ch_length_map) {
|
||||
r_ch_length_map->resize(l);
|
||||
r_ch_length_map->resize_uninitialized(l);
|
||||
map_ptr = r_ch_length_map->ptrw();
|
||||
}
|
||||
|
||||
|
|
@ -1997,7 +1997,7 @@ CharString String::utf8(Vector<uint8_t> *r_ch_length_map) const {
|
|||
return utf8s;
|
||||
}
|
||||
|
||||
utf8s.resize(fl + 1);
|
||||
utf8s.resize_uninitialized(fl + 1);
|
||||
uint8_t *cdst = (uint8_t *)utf8s.get_data();
|
||||
|
||||
#define APPEND_CHAR(m_c) *(cdst++) = m_c
|
||||
|
|
@ -2124,7 +2124,7 @@ Error String::append_utf16(const char16_t *p_utf16, int p_len, bool p_default_li
|
|||
}
|
||||
|
||||
const int prev_length = length();
|
||||
resize(prev_length + str_size + 1);
|
||||
resize_uninitialized(prev_length + str_size + 1);
|
||||
char32_t *dst = ptrw() + prev_length;
|
||||
dst[str_size] = 0;
|
||||
|
||||
|
|
@ -2194,7 +2194,7 @@ Char16String String::utf16() const {
|
|||
return utf16s;
|
||||
}
|
||||
|
||||
utf16s.resize(fl + 1);
|
||||
utf16s.resize_uninitialized(fl + 1);
|
||||
uint16_t *cdst = (uint16_t *)utf16s.get_data();
|
||||
|
||||
#define APPEND_CHAR(m_c) *(cdst++) = m_c
|
||||
|
|
@ -2847,7 +2847,7 @@ Vector<uint8_t> String::md5_buffer() const {
|
|||
CryptoCore::md5((unsigned char *)cs.ptr(), cs.length(), hash);
|
||||
|
||||
Vector<uint8_t> ret;
|
||||
ret.resize(16);
|
||||
ret.resize_uninitialized(16);
|
||||
uint8_t *ret_ptrw = ret.ptrw();
|
||||
for (int i = 0; i < 16; i++) {
|
||||
ret_ptrw[i] = hash[i];
|
||||
|
|
@ -2861,7 +2861,7 @@ Vector<uint8_t> String::sha1_buffer() const {
|
|||
CryptoCore::sha1((unsigned char *)cs.ptr(), cs.length(), hash);
|
||||
|
||||
Vector<uint8_t> ret;
|
||||
ret.resize(20);
|
||||
ret.resize_uninitialized(20);
|
||||
uint8_t *ret_ptrw = ret.ptrw();
|
||||
for (int i = 0; i < 20; i++) {
|
||||
ret_ptrw[i] = hash[i];
|
||||
|
|
@ -2876,7 +2876,7 @@ Vector<uint8_t> String::sha256_buffer() const {
|
|||
CryptoCore::sha256((unsigned char *)cs.ptr(), cs.length(), hash);
|
||||
|
||||
Vector<uint8_t> ret;
|
||||
ret.resize(32);
|
||||
ret.resize_uninitialized(32);
|
||||
uint8_t *ret_ptrw = ret.ptrw();
|
||||
for (int i = 0; i < 32; i++) {
|
||||
ret_ptrw[i] = hash[i];
|
||||
|
|
@ -2894,7 +2894,7 @@ String String::insert(int p_at_pos, const String &p_string) const {
|
|||
}
|
||||
|
||||
String ret;
|
||||
ret.resize(length() + p_string.length() + 1);
|
||||
ret.resize_uninitialized(length() + p_string.length() + 1);
|
||||
char32_t *ret_ptrw = ret.ptrw();
|
||||
const char32_t *this_ptr = ptr();
|
||||
|
||||
|
|
@ -2958,7 +2958,7 @@ String String::remove_char(char32_t p_char) const {
|
|||
|
||||
// If we found at least one occurrence of `char`, create new string, allocating enough space for the current length minus one.
|
||||
String new_string;
|
||||
new_string.resize(len);
|
||||
new_string.resize_uninitialized(len);
|
||||
char32_t *new_ptr = new_string.ptrw();
|
||||
|
||||
// Copy part of input before `char`.
|
||||
|
|
@ -2978,7 +2978,7 @@ String String::remove_char(char32_t p_char) const {
|
|||
new_ptr[new_size] = _null;
|
||||
|
||||
// Shrink new string to fit.
|
||||
new_string.resize(new_size + 1);
|
||||
new_string.resize_uninitialized(new_size + 1);
|
||||
|
||||
return new_string;
|
||||
}
|
||||
|
|
@ -3013,7 +3013,7 @@ static String _remove_chars_common(const String &p_this, const T *p_chars, int p
|
|||
|
||||
// If we found at least one occurrence of `chars`, create new string, allocating enough space for the current length minus one.
|
||||
String new_string;
|
||||
new_string.resize(len);
|
||||
new_string.resize_uninitialized(len);
|
||||
char32_t *new_ptr = new_string.ptrw();
|
||||
|
||||
// Copy part of input before `char`.
|
||||
|
|
@ -3033,7 +3033,7 @@ static String _remove_chars_common(const String &p_this, const T *p_chars, int p
|
|||
new_ptr[new_size] = 0;
|
||||
|
||||
// Shrink new string to fit.
|
||||
new_string.resize(new_size + 1);
|
||||
new_string.resize_uninitialized(new_size + 1);
|
||||
|
||||
return new_string;
|
||||
}
|
||||
|
|
@ -3747,7 +3747,7 @@ Vector<String> String::bigrams() const {
|
|||
if (n_pairs <= 0) {
|
||||
return b;
|
||||
}
|
||||
b.resize(n_pairs);
|
||||
b.resize_initialized(n_pairs);
|
||||
String *b_ptrw = b.ptrw();
|
||||
for (int i = 0; i < n_pairs; i++) {
|
||||
b_ptrw[i] = substr(i, 2);
|
||||
|
|
@ -3893,7 +3893,7 @@ static String _replace_common(const String &p_this, const String &p_key, const S
|
|||
const int with_length = p_with.length();
|
||||
const int old_length = p_this.length();
|
||||
|
||||
new_string.resize(old_length + int(found.size()) * (with_length - key_length) + 1);
|
||||
new_string.resize_uninitialized(old_length + int(found.size()) * (with_length - key_length) + 1);
|
||||
|
||||
char32_t *new_ptrw = new_string.ptrw();
|
||||
const char32_t *old_ptr = p_this.ptr();
|
||||
|
|
@ -3952,7 +3952,7 @@ static String _replace_common(const String &p_this, char const *p_key, char cons
|
|||
const int with_length = with_string.length();
|
||||
const int old_length = p_this.length();
|
||||
|
||||
new_string.resize(old_length + int(found.size()) * (with_length - key_length) + 1);
|
||||
new_string.resize_uninitialized(old_length + int(found.size()) * (with_length - key_length) + 1);
|
||||
|
||||
char32_t *new_ptrw = new_string.ptrw();
|
||||
const char32_t *old_ptr = p_this.ptr();
|
||||
|
|
@ -3998,7 +3998,7 @@ String String::replace_first(const String &p_key, const String &p_with) const {
|
|||
const int with_length = p_with.length();
|
||||
|
||||
String new_string;
|
||||
new_string.resize(old_length + (with_length - key_length) + 1);
|
||||
new_string.resize_uninitialized(old_length + (with_length - key_length) + 1);
|
||||
|
||||
char32_t *new_ptrw = new_string.ptrw();
|
||||
const char32_t *old_ptr = ptr();
|
||||
|
|
@ -4036,7 +4036,7 @@ String String::replace_first(const char *p_key, const char *p_with) const {
|
|||
const int with_length = strlen(p_with);
|
||||
|
||||
String new_string;
|
||||
new_string.resize(old_length + (with_length - key_length) + 1);
|
||||
new_string.resize_uninitialized(old_length + (with_length - key_length) + 1);
|
||||
|
||||
char32_t *new_ptrw = new_string.ptrw();
|
||||
const char32_t *old_ptr = ptr();
|
||||
|
|
@ -4091,7 +4091,7 @@ String String::replace_char(char32_t p_key, char32_t p_with) const {
|
|||
|
||||
// If we found at least one occurrence of `key`, create new string.
|
||||
String new_string;
|
||||
new_string.resize(len + 1);
|
||||
new_string.resize_uninitialized(len + 1);
|
||||
char32_t *new_ptr = new_string.ptrw();
|
||||
|
||||
// Copy part of input before `key`.
|
||||
|
|
@ -4144,7 +4144,7 @@ static String _replace_chars_common(const String &p_this, const T *p_keys, int p
|
|||
|
||||
// If we found at least one occurrence of `keys`, create new string.
|
||||
String new_string;
|
||||
new_string.resize(len + 1);
|
||||
new_string.resize_uninitialized(len + 1);
|
||||
char32_t *new_ptr = new_string.ptrw();
|
||||
|
||||
// Copy part of input before `key`.
|
||||
|
|
@ -4196,7 +4196,7 @@ String String::repeat(int p_count) const {
|
|||
|
||||
int len = length();
|
||||
String new_string = *this;
|
||||
new_string.resize(p_count * len + 1);
|
||||
new_string.resize_uninitialized(p_count * len + 1);
|
||||
|
||||
char32_t *dst = new_string.ptrw();
|
||||
int offset = 1;
|
||||
|
|
@ -4216,7 +4216,7 @@ String String::reverse() const {
|
|||
return *this;
|
||||
}
|
||||
String new_string;
|
||||
new_string.resize(len + 1);
|
||||
new_string.resize_uninitialized(len + 1);
|
||||
|
||||
const char32_t *src = ptr();
|
||||
char32_t *dst = new_string.ptrw();
|
||||
|
|
@ -4909,7 +4909,7 @@ String String::xml_unescape() const {
|
|||
if (len == 0) {
|
||||
return String();
|
||||
}
|
||||
str.resize(len + 1);
|
||||
str.resize_uninitialized(len + 1);
|
||||
char32_t *str_ptrw = str.ptrw();
|
||||
_xml_unescape(get_data(), l, str_ptrw);
|
||||
str_ptrw[len] = 0;
|
||||
|
|
@ -5880,7 +5880,7 @@ Vector<uint8_t> String::to_ascii_buffer() const {
|
|||
|
||||
Vector<uint8_t> retval;
|
||||
size_t len = charstr.length();
|
||||
retval.resize(len);
|
||||
retval.resize_uninitialized(len);
|
||||
uint8_t *w = retval.ptrw();
|
||||
memcpy(w, charstr.ptr(), len);
|
||||
|
||||
|
|
@ -5896,7 +5896,7 @@ Vector<uint8_t> String::to_utf8_buffer() const {
|
|||
|
||||
Vector<uint8_t> retval;
|
||||
size_t len = charstr.length();
|
||||
retval.resize(len);
|
||||
retval.resize_uninitialized(len);
|
||||
uint8_t *w = retval.ptrw();
|
||||
memcpy(w, charstr.ptr(), len);
|
||||
|
||||
|
|
@ -5912,7 +5912,7 @@ Vector<uint8_t> String::to_utf16_buffer() const {
|
|||
|
||||
Vector<uint8_t> retval;
|
||||
size_t len = charstr.length() * sizeof(char16_t);
|
||||
retval.resize(len);
|
||||
retval.resize_uninitialized(len);
|
||||
uint8_t *w = retval.ptrw();
|
||||
memcpy(w, (const void *)charstr.ptr(), len);
|
||||
|
||||
|
|
@ -5927,7 +5927,7 @@ Vector<uint8_t> String::to_utf32_buffer() const {
|
|||
|
||||
Vector<uint8_t> retval;
|
||||
size_t len = s->length() * sizeof(char32_t);
|
||||
retval.resize(len);
|
||||
retval.resize_uninitialized(len);
|
||||
uint8_t *w = retval.ptrw();
|
||||
memcpy(w, (const void *)s->ptr(), len);
|
||||
|
||||
|
|
|
|||
|
|
@ -186,7 +186,9 @@ public:
|
|||
_FORCE_INLINE_ operator Span<T>() const { return Span(ptr(), length()); }
|
||||
_FORCE_INLINE_ Span<T> span() const { return Span(ptr(), length()); }
|
||||
|
||||
_FORCE_INLINE_ Error resize(int p_size) { return _cowdata.template resize<false>(p_size); }
|
||||
/// Resizes the string. The given size must include the null terminator.
|
||||
/// New characters are not initialized, and should be set by the caller.
|
||||
_FORCE_INLINE_ Error resize_uninitialized(int64_t p_size) { return _cowdata.template resize<false>(p_size); }
|
||||
|
||||
_FORCE_INLINE_ T get(int p_index) const { return _cowdata.get(p_index); }
|
||||
_FORCE_INLINE_ void set(int p_index, const T &p_elem) { _cowdata.set(p_index, p_elem); }
|
||||
|
|
@ -221,7 +223,7 @@ public:
|
|||
}
|
||||
_FORCE_INLINE_ CharStringT<T> &operator+=(T p_char) {
|
||||
const int lhs_len = length();
|
||||
resize(lhs_len + 2);
|
||||
resize_uninitialized(lhs_len + 2);
|
||||
|
||||
T *dst = ptrw();
|
||||
dst[lhs_len] = p_char;
|
||||
|
|
@ -233,17 +235,17 @@ public:
|
|||
protected:
|
||||
void copy_from(const T *p_cstr) {
|
||||
if (!p_cstr) {
|
||||
resize(0);
|
||||
resize_uninitialized(0);
|
||||
return;
|
||||
}
|
||||
|
||||
size_t len = strlen(p_cstr);
|
||||
if (len == 0) {
|
||||
resize(0);
|
||||
resize_uninitialized(0);
|
||||
return;
|
||||
}
|
||||
|
||||
Error err = resize(++len); // include terminating null char.
|
||||
Error err = resize_uninitialized(++len); // include terminating null char.
|
||||
|
||||
ERR_FAIL_COND_MSG(err != OK, "Failed to copy C-string.");
|
||||
|
||||
|
|
@ -320,11 +322,14 @@ public:
|
|||
|
||||
void remove_at(int p_index) { _cowdata.remove_at(p_index); }
|
||||
|
||||
_FORCE_INLINE_ void clear() { resize(0); }
|
||||
_FORCE_INLINE_ void clear() { resize_uninitialized(0); }
|
||||
|
||||
_FORCE_INLINE_ char32_t get(int p_index) const { return _cowdata.get(p_index); }
|
||||
_FORCE_INLINE_ void set(int p_index, const char32_t &p_elem) { _cowdata.set(p_index, p_elem); }
|
||||
Error resize(int p_size) { return _cowdata.resize<false>(p_size); }
|
||||
|
||||
/// Resizes the string. The given size must include the null terminator.
|
||||
/// New characters are not initialized, and should be set by the caller.
|
||||
Error resize_uninitialized(int64_t p_size) { return _cowdata.resize<false>(p_size); }
|
||||
|
||||
_FORCE_INLINE_ const char32_t &operator[](int p_index) const {
|
||||
if (unlikely(p_index == _cowdata.size())) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue