31#ifndef ETL_WSTRING_INCLUDED
32#define ETL_WSTRING_INCLUDED
45 inline namespace literals
47 inline namespace string_literals
49 constexpr etl::wstring_view operator ""_sv(
const wchar_t* str,
size_t length)
noexcept
57 typedef ibasic_string<wchar_t> iwstring;
64 template <
size_t MAX_SIZE_>
72 typedef iwstring::value_type value_type;
74 static const size_t MAX_SIZE = MAX_SIZE_;
80 :
iwstring(reinterpret_cast<value_type*>(&buffer), MAX_SIZE)
90 :
iwstring(reinterpret_cast<value_type*>(&buffer), MAX_SIZE)
100 :
iwstring(reinterpret_cast<value_type*>(&buffer), MAX_SIZE)
112 :
iwstring(reinterpret_cast<value_type*>(&buffer), MAX_SIZE)
123 ETL_EXPLICIT_STRING_FROM_CHAR
wstring(
const value_type* text)
124 :
iwstring(reinterpret_cast<value_type*>(&buffer), MAX_SIZE)
134 wstring(
const value_type* text, size_type count)
135 :
iwstring(reinterpret_cast<value_type*>(&buffer), MAX_SIZE)
137 this->
assign(text, text + count);
146 :
iwstring(reinterpret_cast<value_type*>(&buffer), MAX_SIZE)
158 template <
typename TIterator>
160 :
iwstring(reinterpret_cast<value_type*>(&buffer), MAX_SIZE)
162 this->
assign(first, last);
165#if ETL_HAS_INITIALIZER_LIST
169 wstring(std::initializer_list<value_type> init)
170 :
iwstring(reinterpret_cast<value_type*>(&buffer), MAX_SIZE)
172 this->
assign(init.begin(), init.end());
181 :
iwstring(reinterpret_cast<value_type*>(&buffer), MAX_SIZE)
195 if (position !=
size())
199 length_ = etl::min(length_,
size() - position);
201 new_string.
assign(buffer + position, buffer + position + length_);
233#if ETL_HAS_ISTRING_REPAIR
243 value_type buffer[MAX_SIZE + 1];
257 typedef iwstring::value_type value_type;
263 :
iwstring(buffer, buffer_size - 1U)
273 :
iwstring(buffer, buffer_size - 1U)
283 :
iwstring(buffer, buffer_size - 1U)
295 :
iwstring(buffer, buffer_size - 1U)
306 wstring_ext(
const value_type* text, value_type* buffer, size_type buffer_size)
307 :
iwstring(buffer, buffer_size - 1U)
325 wstring_ext(
const value_type* text, size_type count, value_type* buffer, size_type buffer_size)
326 :
iwstring(buffer, buffer_size - 1U)
328 this->
assign(text, text + count);
336 wstring_ext(size_type count, value_type c, value_type* buffer, size_type buffer_size)
337 :
iwstring(buffer, buffer_size - 1U)
349 template <
typename TIterator>
351 :
iwstring(buffer, buffer_size - 1U)
353 this->
assign(first, last);
356#if ETL_HAS_INITIALIZER_LIST
360 wstring_ext(std::initializer_list<value_type> init, value_type* buffer, size_type buffer_size)
361 :
iwstring(buffer, buffer_size - 1U)
363 this->
assign(init.begin(), init.end());
372 :
iwstring(buffer, buffer_size - 1U)
418#if ETL_HAS_ISTRING_REPAIR
435#if ETL_USING_8BIT_TYPES
437 struct hash<
etl::iwstring>
441 return etl::private_hash::generic_hash<size_t>(
reinterpret_cast<const uint8_t*
>(text.
data()),
442 reinterpret_cast<const uint8_t*
>(text.
data() + text.
size()));
446 template <
size_t SIZE>
447 struct hash<
etl::wstring<SIZE> >
451 return etl::private_hash::generic_hash<size_t>(
reinterpret_cast<const uint8_t*
>(text.
data()),
452 reinterpret_cast<const uint8_t*
>(text.
data() + text.
size()));
457 struct hash<
etl::wstring_ext>
461 return etl::private_hash::generic_hash<size_t>(
reinterpret_cast<const uint8_t*
>(text.
data()),
462 reinterpret_cast<const uint8_t*
>(text.
data() + text.
size()));
470 template<
size_t Array_Size>
479 template<
size_t MAX_SIZE,
size_t SIZE>
String view.
Definition: string_view.h:96
ETL_CONSTEXPR const_iterator begin() const
Returns a const iterator to the beginning of the array.
Definition: string_view.h:193
ETL_CONSTEXPR const_iterator end() const
Returns a const iterator to the end of the array.
Definition: string_view.h:209
Definition: basic_string.h:326
void resize(size_type new_size)
Definition: basic_string.h:456
void assign(const etl::ibasic_string< T > &other)
Definition: basic_string.h:626
pointer data()
Definition: basic_string.h:589
void initialise()
Initialise the string.
Definition: basic_string.h:2289
void repair_buffer(T *p_buffer_)
Fix the internal pointers after a low level memory copy.
Definition: basic_string.h:2302
size_type length() const
Definition: basic_string.h:185
size_type current_size
The current number of elements in the string.
Definition: basic_string.h:311
size_type size() const
Definition: basic_string.h:176
Definition: basic_string.h:98
Definition: wstring.h:251
wstring_ext(const etl::iwstring &other, value_type *buffer, size_type buffer_size)
Definition: wstring.h:282
wstring_ext(size_type count, value_type c, value_type *buffer, size_type buffer_size)
Definition: wstring.h:336
wstring_ext(const value_type *text, value_type *buffer, size_type buffer_size)
Definition: wstring.h:306
wstring_ext(value_type *buffer, size_type buffer_size)
Constructor.
Definition: wstring.h:262
wstring_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: wstring.h:350
wstring_ext & operator=(const wstring_ext &rhs)
Assignment operator.
Definition: wstring.h:380
wstring_ext(const etl::wstring_view &view, value_type *buffer, size_type buffer_size)
Definition: wstring.h:371
wstring_ext(const etl::iwstring &other, value_type *buffer, size_type buffer_size, size_type position, size_type length=npos)
Definition: wstring.h:294
void repair()
Fix the internal pointers after a low level memory copy.
Definition: wstring.h:417
wstring_ext(const etl::wstring_ext &other, value_type *buffer, size_type buffer_size)
Definition: wstring.h:272
wstring_ext(const value_type *text, size_type count, value_type *buffer, size_type buffer_size)
Definition: wstring.h:325
wstring(const value_type *text, size_type count)
Definition: wstring.h:134
wstring(const etl::iwstring &other)
Definition: wstring.h:99
wstring(const etl::iwstring &other, size_type position, size_type length=npos)
Definition: wstring.h:111
wstring(const etl::wstring_view &view)
Definition: wstring.h:180
wstring & operator=(const wstring &rhs)
Assignment operator.
Definition: wstring.h:210
void repair()
Fix the internal pointers after a low level memory copy.
Definition: wstring.h:236
wstring(TIterator first, TIterator last, typename etl::enable_if<!etl::is_integral< TIterator >::value, int >::type=0)
Definition: wstring.h:159
wstring()
Constructor.
Definition: wstring.h:79
wstring(size_type count, value_type c)
Definition: wstring.h:145
wstring(const etl::wstring< MAX_SIZE_ > &other)
Definition: wstring.h:89
etl::wstring< MAX_SIZE_ > substr(size_type position=0, size_type length_=npos) const
Definition: wstring.h:191
#define ETL_ASSERT(b, e)
Definition: error_handler.h:316
enable_if
Definition: type_traits_generator.h:1191
is_integral
Definition: type_traits_generator.h:1001
bitset_ext
Definition: absolute.h:38
etl::string< Array_Size - 1U > make_string(const char(&text)[Array_Size])
Hash function.
Definition: string.h:491
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:500
ETL_CONSTEXPR size_t strlen(const T *t)
Alternative strlen for all character types.
Definition: char_traits.h:267
Character traits for any character type.
Definition: char_traits.h:102