31 #ifndef ETL_WSTRING_INCLUDED
32 #define ETL_WSTRING_INCLUDED
39 #if ETL_CPP11_SUPPORTED && ETL_NOT_USING_STLPORT && ETL_USING_STL
40 #include <initializer_list>
47 typedef ibasic_string<wchar_t> iwstring;
54 template <const
size_t MAX_SIZE_>
62 typedef iwstring::value_type value_type;
64 static const size_t MAX_SIZE = MAX_SIZE_;
70 :
iwstring(reinterpret_cast<value_type*>(&buffer), MAX_SIZE)
80 :
iwstring(reinterpret_cast<value_type*>(&buffer), MAX_SIZE)
90 :
iwstring(reinterpret_cast<value_type*>(&buffer), MAX_SIZE)
102 :
iwstring(reinterpret_cast<value_type*>(&buffer), MAX_SIZE)
113 ETL_EXPLICIT_STRING_FROM_CHAR
wstring(
const value_type* text)
114 :
iwstring(reinterpret_cast<value_type*>(&buffer), MAX_SIZE)
124 wstring(
const value_type* text, size_type count)
125 :
iwstring(reinterpret_cast<value_type*>(&buffer), MAX_SIZE)
127 this->
assign(text, text + count);
136 :
iwstring(reinterpret_cast<value_type*>(&buffer), MAX_SIZE)
148 template <
typename TIterator>
150 :
iwstring(reinterpret_cast<value_type*>(&buffer), MAX_SIZE)
152 this->
assign(first, last);
155 #if ETL_CPP11_SUPPORTED && ETL_NOT_USING_STLPORT && ETL_USING_STL
159 wstring(std::initializer_list<value_type> init)
160 :
iwstring(reinterpret_cast<value_type*>(&buffer), MAX_SIZE)
162 this->
assign(init.begin(), init.end());
171 :
iwstring(reinterpret_cast<value_type*>(&buffer), MAX_SIZE)
185 if (position !=
size())
189 length_ = etl::min(length_,
size() - position);
191 new_string.
assign(buffer + position, buffer + position + length_);
223 #ifdef ETL_ISTRING_REPAIR_ENABLE
233 value_type buffer[MAX_SIZE + 1];
247 typedef iwstring::value_type value_type;
253 :
iwstring(buffer, buffer_size - 1U)
263 :
iwstring(buffer, buffer_size - 1U)
273 :
iwstring(buffer, buffer_size - 1U)
285 :
iwstring(buffer, buffer_size - 1U)
296 wstring_ext(
const value_type* text, value_type* buffer, size_type buffer_size)
297 :
iwstring(buffer, buffer_size - 1U)
315 wstring_ext(
const value_type* text, size_type count, value_type* buffer, size_type buffer_size)
316 :
iwstring(buffer, buffer_size - 1U)
318 this->
assign(text, text + count);
326 wstring_ext(size_type count, value_type c, value_type* buffer, size_type buffer_size)
327 :
iwstring(buffer, buffer_size - 1U)
339 template <
typename TIterator>
340 wstring_ext(TIterator first, TIterator last, value_type* buffer, size_type buffer_size)
341 :
iwstring(buffer, buffer_size - 1U)
343 this->
assign(first, last);
346 #if ETL_CPP11_SUPPORTED && ETL_NOT_USING_STLPORT && ETL_USING_STL
350 wstring_ext(std::initializer_list<value_type> init, value_type* buffer, size_type buffer_size)
351 :
iwstring(buffer, buffer_size - 1U)
353 this->
assign(init.begin(), init.end());
362 :
iwstring(buffer, buffer_size - 1U)
408 #ifdef ETL_ISTRING_REPAIR_ENABLE
427 struct hash<
etl::iwstring>
431 return etl::private_hash::generic_hash<size_t>(
reinterpret_cast<const uint8_t*
>(&text[0]),
432 reinterpret_cast<const uint8_t*
>(&text[text.
size()]));
436 template <const
size_t SIZE>
437 struct hash<
etl::wstring<SIZE> >
441 return etl::private_hash::generic_hash<size_t>(
reinterpret_cast<const uint8_t*
>(&text[0]),
442 reinterpret_cast<const uint8_t*
>(&text[text.
size()]));
447 struct hash<
etl::wstring_ext>
451 return etl::private_hash::generic_hash<size_t>(
reinterpret_cast<const uint8_t*
>(&text[0]),
452 reinterpret_cast<const uint8_t*
>(&text[text.
size()]));
460 template<
size_t ARRAY_SIZE>
463 return etl::wstring<ARRAY_SIZE == 1 ? 1 : ARRAY_SIZE - 1>(text, ARRAY_SIZE - 1);
469 template<const
size_t MAX_SIZE, const
size_t SIZE>
String view.
Definition: string_view.h:104
const_iterator begin() const
Returns a const iterator to the beginning of the array.
Definition: string_view.h:201
const_iterator end() const
Returns a const iterator to the end of the array.
Definition: string_view.h:217
Definition: basic_string.h:321
void resize(size_type new_size)
Definition: basic_string.h:451
void assign(const etl::ibasic_string< T > &other)
Definition: basic_string.h:590
void initialise()
Initialise the string.
Definition: basic_string.h:2201
void repair_buffer(T *p_buffer_)
Fix the internal pointers after a low level memory copy.
Definition: basic_string.h:2214
size_type length() const
Definition: basic_string.h:177
size_type current_size
The current number of elements in the string.
Definition: basic_string.h:306
size_type size() const
Definition: basic_string.h:168
Definition: basic_string.h:108
Definition: wstring.h:241
wstring_ext(const etl::iwstring &other, value_type *buffer, size_type buffer_size)
Definition: wstring.h:272
wstring_ext(size_type count, value_type c, value_type *buffer, size_type buffer_size)
Definition: wstring.h:326
wstring_ext(const value_type *text, value_type *buffer, size_type buffer_size)
Definition: wstring.h:296
wstring_ext(value_type *buffer, size_type buffer_size)
Constructor.
Definition: wstring.h:252
wstring_ext(const etl::wstring_view &view, value_type *buffer, size_type buffer_size)
Definition: wstring.h:361
wstring_ext(const etl::iwstring &other, value_type *buffer, size_type buffer_size, size_type position, size_type length=npos)
Definition: wstring.h:284
void repair()
Fix the internal pointers after a low level memory copy.
Definition: wstring.h:407
wstring_ext(TIterator first, TIterator last, value_type *buffer, size_type buffer_size)
Definition: wstring.h:340
wstring_ext & operator=(const wstring_ext &rhs)
Assignment operator.
Definition: wstring.h:370
wstring_ext(const etl::wstring_ext &other, value_type *buffer, size_type buffer_size)
Definition: wstring.h:262
wstring_ext(const value_type *text, size_type count, value_type *buffer, size_type buffer_size)
Definition: wstring.h:315
wstring(const value_type *text, size_type count)
Definition: wstring.h:124
wstring(const etl::iwstring &other)
Definition: wstring.h:89
wstring(const etl::iwstring &other, size_type position, size_type length=npos)
Definition: wstring.h:101
wstring(const etl::wstring_view &view)
Definition: wstring.h:170
etl::wstring< MAX_SIZE_ > substr(size_type position=0, size_type length_=npos) const
Definition: wstring.h:181
wstring & operator=(const wstring &rhs)
Assignment operator.
Definition: wstring.h:200
void repair()
Fix the internal pointers after a low level memory copy.
Definition: wstring.h:226
wstring(TIterator first, TIterator last)
Definition: wstring.h:149
wstring()
Constructor.
Definition: wstring.h:69
wstring(size_type count, value_type c)
Definition: wstring.h:135
wstring(const etl::wstring< MAX_SIZE_ > &other)
Definition: wstring.h:79
#define ETL_ASSERT(b, e)
Definition: error_handler.h:290
Definition: absolute.h:37
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:487
size_t strlen(const T *t)
Alternative strlen for all character types.
Definition: char_traits.h:247
etl::string< ARRAY_SIZE - 1 > make_string(const char(&text)[ARRAY_SIZE])
Hash function.
Definition: string.h:478
Character traits for any character type.
Definition: char_traits.h:97