31 #ifndef ETL_STRING_INCLUDED
32 #define ETL_STRING_INCLUDED
41 #if ETL_CPP11_SUPPORTED && ETL_NOT_USING_STLPORT && ETL_USING_STL
42 #include <initializer_list>
56 template <const
size_t MAX_SIZE_>
64 typedef istring::value_type value_type;
66 static const size_t MAX_SIZE = MAX_SIZE_;
72 :
istring(reinterpret_cast<value_type*>(&buffer), MAX_SIZE)
82 :
istring(reinterpret_cast<value_type*>(&buffer), MAX_SIZE)
92 :
istring(reinterpret_cast<value_type*>(&buffer), MAX_SIZE)
104 :
istring(reinterpret_cast<value_type*>(&buffer), MAX_SIZE)
115 ETL_EXPLICIT_STRING_FROM_CHAR
string(
const value_type* text)
116 :
istring(reinterpret_cast<value_type*>(&buffer), MAX_SIZE)
126 string(
const value_type* text,
size_t count)
127 :
istring(reinterpret_cast<value_type*>(&buffer), MAX_SIZE)
129 this->
assign(text, text + count);
138 :
istring(reinterpret_cast<value_type*>(&buffer), MAX_SIZE)
150 template <
typename TIterator>
152 :
istring(reinterpret_cast<value_type*>(&buffer), MAX_SIZE)
154 this->
assign(first, last);
157 #if ETL_CPP11_SUPPORTED && ETL_NOT_USING_STLPORT && ETL_USING_STL
161 string(std::initializer_list<value_type> init)
162 :
istring(reinterpret_cast<value_type*>(&buffer), MAX_SIZE)
164 this->
assign(init.begin(), init.end());
173 :
istring(reinterpret_cast<value_type*>(&buffer), MAX_SIZE)
187 if (position != this->
size())
191 length_ = etl::min(length_, this->
size() - position);
193 new_string.
assign(buffer + position, buffer + position + length_);
240 #ifdef ETL_ISTRING_REPAIR_ENABLE
249 value_type buffer[MAX_SIZE + 1];
263 typedef istring::value_type value_type;
264 typedef istring::size_type size_type;
270 :
istring(buffer, buffer_size - 1U)
280 :
istring(buffer, buffer_size - 1U)
290 :
istring(buffer, buffer_size - 1U)
302 :
istring(buffer, buffer_size - 1U)
313 string_ext(
const char* text,
char* buffer, size_type buffer_size)
314 :
istring(buffer, buffer_size - 1U)
332 string_ext(
const value_type* text, size_type count, value_type* buffer, size_type buffer_size)
333 :
istring(buffer, buffer_size - 1U)
335 this->
assign(text, text + count);
343 string_ext(size_type count, value_type c, value_type* buffer, size_type buffer_size)
344 :
istring(buffer, buffer_size - 1U)
356 template <
typename TIterator>
357 string_ext(TIterator first, TIterator last, value_type* buffer, size_type buffer_size)
358 :
istring(buffer, buffer_size - 1U)
360 this->
assign(first, last);
363 #if ETL_CPP11_SUPPORTED && ETL_NOT_USING_STLPORT && ETL_USING_STL
367 string_ext(std::initializer_list<value_type> init, value_type* buffer, size_type buffer_size)
368 :
istring(buffer, buffer_size - 1U)
370 this->
assign(init.begin(), init.end());
379 :
istring(buffer, buffer_size - 1U)
425 #ifdef ETL_ISTRING_REPAIR_ENABLE
444 struct hash<
etl::istring>
448 return etl::private_hash::generic_hash<size_t>(
reinterpret_cast<const uint8_t*
>(&text[0]),
449 reinterpret_cast<const uint8_t*
>(&text[text.
size()]));
453 template <const
size_t SIZE>
454 struct hash<
etl::string<SIZE> >
458 return etl::private_hash::generic_hash<size_t>(
reinterpret_cast<const uint8_t*
>(&text[0]),
459 reinterpret_cast<const uint8_t*
>(&text[text.
size()]));
464 struct hash<
etl::string_ext>
468 return etl::private_hash::generic_hash<size_t>(
reinterpret_cast<const uint8_t*
>(&text[0]),
469 reinterpret_cast<const uint8_t*
>(&text[text.
size()]));
477 template<
size_t ARRAY_SIZE>
480 return etl::string<ARRAY_SIZE - 1>(text, ARRAY_SIZE - 1);
486 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
string_ext(const etl::istring &other, value_type *buffer, size_type buffer_size, size_type position, size_type length=npos)
Definition: string.h:301
string_ext(value_type *buffer, size_type buffer_size)
Constructor.
Definition: string.h:269
string_ext(const etl::string_ext &other, value_type *buffer, size_type buffer_size)
Definition: string.h:279
string_ext(const etl::string_view &view, value_type *buffer, size_type buffer_size)
Definition: string.h:378
string_ext(const char *text, char *buffer, size_type buffer_size)
Definition: string.h:313
string_ext(size_type count, value_type c, value_type *buffer, size_type buffer_size)
Definition: string.h:343
string_ext(const etl::istring &other, value_type *buffer, size_type buffer_size)
Definition: string.h:289
string_ext & operator=(const string_ext &rhs)
Assignment operator.
Definition: string.h:387
void repair()
Fix the internal pointers after a low level memory copy.
Definition: string.h:424
string_ext(const value_type *text, size_type count, value_type *buffer, size_type buffer_size)
Definition: string.h:332
string_ext(TIterator first, TIterator last, value_type *buffer, size_type buffer_size)
Definition: string.h:357
Definition: basic_string.h:108
string & operator=(const string &rhs)
Assignment operator.
Definition: string.h:202
void repair()
Fix the internal pointers after a low level memory copy.
Definition: string.h:239
string()
Constructor.
Definition: string.h:71
etl::string< MAX_SIZE_ > substr(size_type position=0, size_type length_=npos) const
Definition: string.h:183
string(const etl::string_view &view)
Definition: string.h:172
string(TIterator first, TIterator last)
Definition: string.h:151
string(const etl::string< MAX_SIZE_ > &other)
Definition: string.h:81
string(const etl::istring &other)
Definition: string.h:91
string(const etl::istring &other, size_t position, size_t length=npos)
Definition: string.h:103
string(const value_type *text, size_t count)
Definition: string.h:126
string(size_type count, value_type c)
Definition: string.h:137
#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