31#ifndef ETL_U16STRING_INCLUDED
32#define ETL_U16STRING_INCLUDED
45 inline namespace literals
47 inline namespace string_literals
49 inline constexpr etl::u16string_view
operator ""_sv(
const char16_t* str,
size_t length) ETL_NOEXCEPT
51 return etl::u16string_view{ str, length };
64 template <
size_t MAX_SIZE_>
69 typedef iu16string base_type;
70 typedef iu16string interface_type;
72 typedef iu16string::value_type value_type;
74 static const size_t MAX_SIZE = MAX_SIZE_;
80 : iu16string(reinterpret_cast<value_type*>(&buffer), MAX_SIZE)
90 : iu16string(reinterpret_cast<value_type*>(&buffer), MAX_SIZE)
101 : iu16string(reinterpret_cast<value_type*>(&buffer), MAX_SIZE)
114 : iu16string(reinterpret_cast<value_type*>(&buffer), MAX_SIZE)
126 ETL_EXPLICIT_STRING_FROM_CHAR
u16string(
const value_type* text)
127 : iu16string(reinterpret_cast<value_type*>(&buffer), MAX_SIZE)
139 : iu16string(reinterpret_cast<value_type*>(&buffer), MAX_SIZE)
142 this->
assign(text, text + count);
151 : iu16string(reinterpret_cast<value_type*>(&buffer), MAX_SIZE)
163 template <
typename TIterator>
165 : iu16string(reinterpret_cast<value_type*>(&buffer), MAX_SIZE)
168 this->
assign(first, last);
171#if ETL_HAS_INITIALIZER_LIST
175 u16string(std::initializer_list<value_type> init)
176 : iu16string(reinterpret_cast<
value_type*>(&buffer), MAX_SIZE)
179 this->
assign(init.begin(), init.end());
188 : iu16string(reinterpret_cast<value_type*>(&buffer), MAX_SIZE)
203 if (position !=
size())
207 length_ = etl::min(length_,
size() - position);
209 new_string.
assign(buffer + position, buffer + position + length_);
251#if ETL_HAS_ISTRING_REPAIR
252 virtual void repair() ETL_OVERRIDE
273 typedef iu16string base_type;
274 typedef iu16string interface_type;
276 typedef iu16string::value_type value_type;
277 typedef iu16string::size_type size_type;
283 : iu16string(buffer, buffer_size - 1U)
293 : iu16string(buffer, buffer_size - 1U)
297 this->current_size = other.size();
310 u16string_ext(
const etl::iu16string& other, value_type* buffer, size_type buffer_size)
311 : iu16string(buffer, buffer_size - 1U)
315 this->current_size = other.size();
330 u16string_ext(
const etl::iu16string& other, value_type* buffer, size_type buffer_size, size_type position, size_type
length = npos)
331 : iu16string(buffer, buffer_size - 1U)
350 template <
typename TPo
inter>
353 : iu16string(buffer, buffer_size - 1U)
370 template <
size_t Size>
371 u16string_ext(
const value_type (&literal)[Size], value_type* buffer, size_type buffer_size)
372 : iu16string(buffer, buffer_size - 1U)
390 u16string_ext(
const value_type* text, size_type count, value_type* buffer, size_type buffer_size)
391 : iu16string(buffer, buffer_size - 1U)
400 this->
assign(text, text + count);
409 u16string_ext(size_type count, value_type c, value_type* buffer, size_type buffer_size)
410 : iu16string(buffer, buffer_size - 1U)
420 explicit u16string_ext(
const etl::u16string_view& view, value_type* buffer, size_type buffer_size)
421 : iu16string(buffer, buffer_size - 1U)
425 this->current_size = view.size();
430 this->assign(view.begin(), view.end());
440 template <
typename TIterator>
442 : iu16string(buffer, buffer_size - 1U)
451 this->
assign(first, last);
455#if ETL_HAS_INITIALIZER_LIST
460 : iu16string(buffer, buffer_size - 1U)
463 this->
assign(init.begin(), init.end());
516#if ETL_HAS_ISTRING_REPAIR
517 virtual void repair() ETL_OVERRIDE
535#if ETL_USING_8BIT_TYPES
537 struct hash<
etl::iu16string>
539 size_t operator()(
const etl::iu16string& text)
const
541 return etl::private_hash::generic_hash<size_t>(
reinterpret_cast<const uint8_t*
>(text.
data()),
542 reinterpret_cast<const uint8_t*
>(text.
data() + text.
size()));
546 template <
size_t SIZE>
549 size_t operator()(
const etl::u16string<SIZE>& text)
const
551 return etl::private_hash::generic_hash<size_t>(
reinterpret_cast<const uint8_t*
>(text.
data()),
552 reinterpret_cast<const uint8_t*
>(text.
data() + text.
size()));
559 size_t operator()(
const etl::u16string_ext& text)
const
561 return etl::private_hash::generic_hash<size_t>(
reinterpret_cast<const uint8_t*
>(text.
data()),
562 reinterpret_cast<const uint8_t*
>(text.
data() + text.
size()));
570 template<
size_t Array_Size>
579 template<
size_t MAX_SIZE,
size_t SIZE>
ETL_CONSTEXPR const_pointer data() const ETL_NOEXCEPT
Returns a const pointer to the first element of the internal storage.
Definition string_view.h:196
ETL_CONSTEXPR const_iterator end() const ETL_NOEXCEPT
Returns a const iterator to the end of the array.
Definition string_view.h:220
ETL_CONSTEXPR const_iterator begin() const ETL_NOEXCEPT
Returns a const iterator to the beginning of the array.
Definition string_view.h:204
Definition basic_string.h:351
bool is_within_buffer(const_pointer ptr) const
Definition basic_string.h:2718
void resize(size_type new_size)
Definition basic_string.h:481
void assign(const etl::ibasic_string< char16_t > &other)
Definition basic_string.h:683
pointer data()
Definition basic_string.h:646
void initialise()
Definition basic_string.h:2491
void repair_buffer(char16_t *p_buffer_)
Definition basic_string.h:2503
size_type length() const
Definition basic_string.h:202
size_type current_size
The current number of elements in the string.
Definition basic_string.h:336
size_type size() const
Definition basic_string.h:193
Definition basic_string.h:115
Definition u16string.h:270
u16string_ext & operator=(const u16string_ext &rhs)
Assignment operator.
Definition u16string.h:470
u16string_ext(size_type count, value_type c, value_type *buffer, size_type buffer_size)
Definition u16string.h:409
u16string_ext(value_type *buffer, size_type buffer_size)
Constructor.
Definition u16string.h:282
u16string_ext(TPointer text, value_type *buffer, size_type buffer_size, typename etl::enable_if< etl::is_same< const value_type *, TPointer >::value, int >::type *=ETL_NULLPTR)
Definition u16string.h:351
u16string_ext(TIterator first, TIterator last, value_type *buffer, size_type buffer_size, typename etl::enable_if<!etl::is_integral< TIterator >::value, int >::type=0)
Definition u16string.h:441
u16string_ext(const etl::u16string_view &view, value_type *buffer, size_type buffer_size)
Definition u16string.h:420
u16string_ext(const value_type(&literal)[Size], value_type *buffer, size_type buffer_size)
Definition u16string.h:371
u16string_ext(const value_type *text, size_type count, value_type *buffer, size_type buffer_size)
Definition u16string.h:390
u16string_ext(const etl::iu16string &other, value_type *buffer, size_type buffer_size, size_type position, size_type length=npos)
Definition u16string.h:330
u16string_ext(const etl::iu16string &other, value_type *buffer, size_type buffer_size)
Definition u16string.h:310
void repair()
Fix the internal pointers after a low level memory copy.
Definition u16string.h:519
u16string_ext(const etl::u16string_ext &other, value_type *buffer, size_type buffer_size)
Definition u16string.h:292
Definition u16string.h:66
u16string(const etl::iu16string &other)
Definition u16string.h:100
u16string(const etl::iu16string &other, size_type position, size_type length=npos)
Definition u16string.h:113
etl::u16string< MAX_SIZE_ > substr(size_type position=0, size_type length_=npos) const
Definition u16string.h:199
u16string(size_type count, value_type c)
Definition u16string.h:150
u16string(TIterator first, TIterator last, typename etl::enable_if<!etl::is_integral< TIterator >::value, int >::type=0)
Definition u16string.h:164
ETL_EXPLICIT_STRING_FROM_CHAR u16string(const value_type *text)
Definition u16string.h:126
u16string & operator=(const u16string &rhs)
Assignment operator.
Definition u16string.h:218
u16string(const etl::u16string_view &view)
Definition u16string.h:187
u16string(const etl::u16string< MAX_SIZE_ > &other)
Definition u16string.h:89
u16string()
Constructor.
Definition u16string.h:79
u16string(const value_type *text, size_type count)
Definition u16string.h:138
void repair()
Fix the internal pointers after a low level memory copy.
Definition u16string.h:254
#define ETL_ASSERT(b, e)
Definition error_handler.h:356
ETL_CONSTEXPR17 etl::enable_if<!etl::is_same< T, etl::nullptr_t >::value, T >::type * addressof(T &t)
Definition addressof.h:52
enable_if
Definition type_traits_generator.h:1254
is_same
Definition type_traits_generator.h:1104
bitset_ext
Definition absolute.h:39
etl::string< Array_Size - 1U > make_string(const char(&text)[Array_Size])
Hash function.
Definition string.h:591
etl::string< MAX_SIZE > make_string_with_capacity(const char(&text)[SIZE])
Make string with max capacity from string literal or array.
Definition string.h:600
ETL_CONSTEXPR14 size_t strlen(const T *t) ETL_NOEXCEPT
Alternative strlen for all character types.
Definition char_traits.h:287