COMMON: Add constructor to make U32String from a character

This commit is contained in:
djsrv 2021-07-14 23:10:25 -04:00 committed by D.J. Servilla
parent 163424abbb
commit b2988ce682
2 changed files with 10 additions and 0 deletions

View file

@ -49,6 +49,13 @@ U32String::U32String(const String &str, Common::CodePage page) : BaseString<u32c
decodeInternal(str.c_str(), str.size(), page);
}
U32String::U32String(u32char_type_t c) : BaseString<u32char_type_t>() {
_storage[0] = c;
_storage[1] = 0;
_size = (c == 0) ? 0 : 1;
}
U32String &U32String::operator=(const U32String &str) {
assign(str);
return *this;

View file

@ -95,6 +95,9 @@ public:
/** Construct a copy of the given string. */
U32String(const String &str, CodePage page = kUtf8);
/** Construct a string consisting of the given character. */
explicit U32String(value_type c);
/** Assign a given string to this string. */
U32String &operator=(const U32String &str);