31#ifndef ETL_BASIC_STRING_INCLUDED
32#define ETL_BASIC_STRING_INCLUDED
52#if ETL_USING_LIBC_WCHAR_H
56#if ETL_USING_STL && ETL_USING_CPP17
57 #include <string_view>
60#if ETL_USING_STD_OSTREAM
75 template <
typename T,
typename TTraits>
89 string_exception(string_type reason_, string_type file_name_, numeric_type line_number_)
90 :
exception(reason_, file_name_, line_number_)
103 string_out_of_bounds(string_type file_name_, numeric_type line_number_)
104 : string_exception(ETL_ERROR_TEXT(
"string:bounds", ETL_BASIC_STRING_FILE_ID
"B"), file_name_, line_number_)
117 string_iterator(string_type file_name_, numeric_type line_number_)
118 : string_exception(ETL_ERROR_TEXT(
"string:iterator", ETL_BASIC_STRING_FILE_ID
"C"), file_name_, line_number_)
131 string_truncation(string_type file_name_, numeric_type line_number_)
132 : string_exception(ETL_ERROR_TEXT(
"string:truncation", ETL_BASIC_STRING_FILE_ID
"D"), file_name_, line_number_)
144 template <
typename T =
void>
149 typedef size_t size_type;
151 static ETL_CONSTANT uint_least8_t IS_TRUNCATED = etl::bit<0>::value;
152 static ETL_CONSTANT uint_least8_t CLEAR_AFTER_USE = etl::bit<1>::value;
157 template <
typename T>
158 ETL_CONSTANT uint_least8_t string_base_statics<T>::IS_TRUNCATED;
160 template <
typename T>
161 ETL_CONSTANT uint_least8_t string_base_statics<T>::CLEAR_AFTER_USE;
163 template <
typename T>
164 ETL_CONSTANT
typename string_base_statics<T>::size_type string_base_statics<T>::npos;
172 typedef size_t size_type;
243#if ETL_HAS_STRING_TRUNCATION_CHECKS
244 return flags.test<IS_TRUNCATED>();
261#if ETL_HAS_STRING_TRUNCATION_CHECKS
267 flags.set<IS_TRUNCATED,
false>();
271#if ETL_HAS_STRING_CLEAR_AFTER_USE
277 flags.set<CLEAR_AFTER_USE>();
286#if ETL_HAS_STRING_CLEAR_AFTER_USE
287 return flags.test<CLEAR_AFTER_USE>();
304#if ETL_HAS_STRING_TRUNCATION_CHECKS
310 flags.set<IS_TRUNCATED>(status);
322#if ETL_HAS_STRING_TRUNCATION_CHECKS || ETL_HAS_STRING_CLEAR_AFTER_USE
333 template <
typename T>
340 typedef T value_type;
341 typedef T& reference;
342 typedef const T& const_reference;
344 typedef const T* const_pointer;
346 typedef const T* const_iterator;
347 typedef ETL_OR_STD::reverse_iterator<iterator> reverse_iterator;
348 typedef ETL_OR_STD::reverse_iterator<const_iterator> const_reverse_iterator;
350 typedef typename etl::iterator_traits<iterator>::difference_type difference_type;
383 const_iterator
end()
const
412 return reverse_iterator(
end());
421 return const_reverse_iterator(
end());
430 return reverse_iterator(
begin());
437 const_reverse_iterator
rend()
const
439 return const_reverse_iterator(
begin());
448 return const_reverse_iterator(
cend());
455 const_reverse_iterator
crend()
const
457 return const_reverse_iterator(
cbegin());
480#if ETL_HAS_STRING_TRUNCATION_CHECKS
483 #if ETL_HAS_ERROR_ON_STRING_TRUNCATION
489 new_size = etl::min(new_size,
CAPACITY);
494 etl::fill(p_buffer +
current_size, p_buffer + new_size, value);
498 p_buffer[new_size] = 0;
505 template <
typename TOperation>
525 new_size = etl::min(new_size,
CAPACITY);
528 p_buffer[new_size] = 0;
570 reference
at(size_type i)
583 const_reference
at(size_type i)
const
616 return p_buffer[
size() - 1];
626 return p_buffer[
size() - 1];
642 ETL_CONSTEXPR const_pointer
data()
const
692 if (sublength == npos)
694 sublength = other.
size() - subposition;
711 template <
typename TIterator>
712 void assign(TIterator first, TIterator last)
714 append_impl(
begin(), first, last,
false,
false);
724 append_impl(
begin(), str,
false,
false);
733 void assign(const_pointer str, size_type n)
735 append_impl(
begin(), str, str + n,
false,
false);
741 template <
typename TOtherTraits>
744 append_impl(
begin(), view.
begin(), view.
end(),
false,
false);
757#if ETL_HAS_STRING_TRUNCATION_CHECKS
760 #if ETL_HAS_ERROR_ON_STRING_TRUNCATION
767 etl::fill_n(
begin(), n, c);
795#if ETL_HAS_STRING_TRUNCATION_CHECKS
798 #if ETL_HAS_ERROR_ON_STRING_TRUNCATION
836 if (sublength == npos)
838 sublength = str.
size() - subposition;
853 template <
class TIterator>
856 append_impl(
end(), first, last,
false,
false);
867 append_impl(
end(), str,
false,
false);
879 append_impl(
end(), str, str + n,
false,
false);
888 template <
typename TOtherTraits>
891 append_impl(
end(), view.
begin(), view.
end(),
false,
false);
905#if ETL_HAS_STRING_TRUNCATION_CHECKS
908 #if ETL_HAS_ERROR_ON_STRING_TRUNCATION
913 n = etl::min(n,
size_t(free_space));
915 etl::fill_n(
end(), n, c);
927 iterator
insert(const_iterator position, T value)
937 if (position !=
end())
942 *insert_position = value;
947 *insert_position = value;
954 if (position !=
end())
958 *insert_position = value;
961#if ETL_HAS_STRING_TRUNCATION_CHECKS
964 #if ETL_HAS_ERROR_ON_STRING_TRUNCATION
972 return insert_position;
981 iterator
insert(const_iterator position, size_type n, T value)
994 const size_type start =
static_cast<size_type
>(etl::distance(
cbegin(), position));
999#if ETL_HAS_STRING_TRUNCATION_CHECKS
1002 #if ETL_HAS_ERROR_ON_STRING_TRUNCATION
1014#if ETL_HAS_STRING_TRUNCATION_CHECKS
1017 #if ETL_HAS_ERROR_ON_STRING_TRUNCATION
1024 etl::fill(insert_position,
end(), value);
1029 const size_type shift_amount = n;
1030 const size_type to_position = start + shift_amount;
1031 const size_type remaining_characters =
current_size - start;
1032 const size_type max_shift_characters =
CAPACITY - start - shift_amount;
1033 const size_type characters_to_shift = etl::min(max_shift_characters, remaining_characters);
1036 if ((start + shift_amount + remaining_characters) >
CAPACITY)
1040#if ETL_HAS_STRING_TRUNCATION_CHECKS
1043 #if ETL_HAS_ERROR_ON_STRING_TRUNCATION
1053 etl::mem_move(insert_position, insert_position + characters_to_shift,
begin() + to_position);
1054 etl::fill(insert_position, insert_position + shift_amount, value);
1070 template <
typename TIterator>
1071 iterator
insert(const_iterator position, TIterator first, TIterator last)
1083 const size_type start =
static_cast<size_type
>(etl::distance(
begin(), position_));
1084 const size_type n =
static_cast<size_type
>(etl::distance(first, last));
1089#if ETL_HAS_STRING_TRUNCATION_CHECKS
1092 #if ETL_HAS_ERROR_ON_STRING_TRUNCATION
1104#if ETL_HAS_STRING_TRUNCATION_CHECKS
1107 #if ETL_HAS_ERROR_ON_STRING_TRUNCATION
1115 position_ = copy_characters(first,
static_cast<size_t>(etl::distance(position_,
end())), position_);
1120 const size_type shift_amount = n;
1121 const size_type to_position = start + shift_amount;
1122 const size_type remaining_characters =
current_size - start;
1123 const size_type max_shift_characters =
CAPACITY - start - shift_amount;
1124 const size_type characters_to_shift = etl::min(max_shift_characters, remaining_characters);
1127 if ((start + shift_amount + remaining_characters) >
CAPACITY)
1131#if ETL_HAS_STRING_TRUNCATION_CHECKS
1134 #if ETL_HAS_ERROR_ON_STRING_TRUNCATION
1148 position_ = copy_characters(first,
static_cast<size_t>(etl::distance(first, last)), position_);
1163 template <
typename TOtherTraits>
1180#if ETL_HAS_STRING_TRUNCATION_CHECKS
1185 #if ETL_HAS_ERROR_ON_STRING_TRUNCATION
1199 template <
typename TOtherTraits>
1222 if ((sublength == npos) || (subposition + sublength > str.
size()))
1224 sublength = str.
size() - subposition;
1229#if ETL_HAS_STRING_TRUNCATION_CHECKS
1234 #if ETL_HAS_ERROR_ON_STRING_TRUNCATION
1250 template <
typename TOtherTraits>
1256 if ((sublength == npos) || (subposition + sublength > view.
size()))
1258 sublength = view.
size() - subposition;
1319 length_ = etl::min(length_,
size() - position);
1348 iterator
erase(const_iterator i_element)
1369 iterator
erase(const_iterator first, const_iterator last)
1376 if (first_ == last_)
1382 size_type n_delete =
static_cast<size_type
>(etl::distance(first_, last_));
1405 size_type
copy(pointer dest, size_type count, size_type pos = 0)
const
1411 count = etl::min(count,
size() - pos);
1415 count =
size() - pos;
1435 return find_impl(str.
begin(), str.
end(), str.
size(), pos);
1443 template <
typename TOtherTraits>
1446 return find_impl(view.
begin(), view.
end(), view.
size(), pos);
1454 size_type
find(const_pointer s, size_type pos = 0)
const
1458 return find_impl(s, s + sz, sz, pos);
1467 size_type
find(const_pointer s, size_type pos, size_type n)
const
1469 return find_impl(s, s + n, n, pos);
1477 size_type
find(T c, size_type position = 0)
const
1479 const_iterator i = etl::find(
begin() + position,
end(), c);
1483 return static_cast<size_type
>(etl::distance(
begin(), i));
1498 return rfind_impl(str.
rbegin(), str.
rend(), str.
size(), position);
1506 template <
typename TOtherTraits>
1517 size_type
rfind(const_pointer s, size_type position = npos)
const
1521 const_reverse_iterator srbegin(s + len);
1522 const_reverse_iterator srend(s);
1524 return rfind_impl(srbegin, srend, len, position);
1532 size_type
rfind(const_pointer s, size_type position, size_type length_)
const
1534 const_reverse_iterator srbegin(s + length_);
1535 const_reverse_iterator srend(s);
1537 return rfind_impl(srbegin, srend, length_, position);
1545 size_type
rfind(T c, size_type position = npos)
const
1547 if (position >=
size())
1552 position =
size() - position;
1554 const_reverse_iterator i = etl::find(
rbegin() +
static_cast<difference_type
>(position),
rend(), c);
1558 return size() -
static_cast<size_type
>(etl::distance(
rbegin(), i)) - 1;
1571 return find(str) != npos;
1577 template <
typename TOtherTraits>
1580 return find(view) != npos;
1588 return find(s) != npos;
1596 return find(c) != npos;
1610 template <
typename TOtherTraits>
1623 return compare(0, len, s, len) == 0;
1650 template <
typename TOtherTraits>
1695 length_ = etl::min(length_,
size() - position);
1706 template <
typename TOtherTraits>
1712 length_ = etl::min(length_,
size() - position);
1714 return replace_impl(
begin() + position,
begin() + position + length_, view.
begin(), view.
size(),
false);
1734 template <
typename TOtherTraits>
1737 return replace_impl(first, last, view.
begin(), view.
size(),
false);
1750 length_ = etl::min(length_,
size() - position);
1751 sublength = etl::min(sublength, str.
size() - subposition);
1760 template <
typename TOtherTraits>
1762 size_type sublength)
1768 length_ = etl::min(length_,
size() - position);
1769 sublength = etl::min(sublength, view.
size() - subposition);
1771 return replace_impl(
begin() + position,
begin() + position + length_, view.
begin() + subposition, sublength,
false);
1782 length_ = etl::min(length_,
size() - position);
1798 return replace_impl(first, last, s, n,
false);
1804 template <
typename TIterator>
1808 return replace_impl(first, last, s,
etl::strlen(s),
false);
1814 template <
size_t Size>
1817 return replace_impl(first, last, literal, Size,
false);
1829 length_ = etl::min(length_,
size() - position);
1831 return replace_impl(
begin() + position,
begin() + position + length_, s, n,
false);
1842 length_ = etl::min(length_,
size() - position);
1845 erase(position, length_);
1863 erase(first_, last_);
1875 template <
typename TIterator>
1883 erase(first_, last_);
1886 insert(first_, first_replace, last_replace);
1896 return compare(p_buffer, p_buffer +
size(), str.p_buffer, str.p_buffer + str.
size());
1902 template <
typename TOtherTraits>
1916 length_ = etl::min(length_,
size() - position);
1918 return compare(p_buffer + position, p_buffer + position + length_, str.p_buffer, str.p_buffer + str.
size());
1924 template <
typename TOtherTraits>
1927 return compare(p_buffer + position, p_buffer + position + length_, view.
data(), view.
data() + view.
size());
1933 int compare(size_type position, size_type length_,
const ibasic_string& str, size_type subposition, size_type sublength)
const
1939 length_ = etl::min(length_,
size() - position);
1940 sublength = etl::min(sublength, str.
size() - subposition);
1942 return compare(p_buffer + position, p_buffer + position + length_, str.p_buffer + subposition, str.p_buffer + subposition + sublength);
1949 template <
typename TOtherTraits>
1951 size_type sublength)
const
1957 length_ = etl::min(length_,
size() - position);
1958 sublength = etl::min(sublength, view.
size() - subposition);
1960 return compare(p_buffer + position, p_buffer + position + length_, view.
data() + subposition, view.
data() + subposition + sublength);
1974 int compare(size_type position, size_type length_, const_pointer s)
const
1976 return compare(p_buffer + position, p_buffer + position + length_, s, s +
etl::strlen(s));
1982 int compare(size_type position, size_type length_, const_pointer s, size_type n)
const
1984 return compare(p_buffer + position, p_buffer + position + length_, s, s + n);
2012 template <
typename TOtherTraits>
2026 if (position <
size())
2028 for (size_type i = position; i <
size(); ++i)
2030 for (size_type j = 0; j < n; ++j)
2032 if (p_buffer[i] == s[j])
2050 if (position <
size())
2052 for (size_type i = position; i <
size(); ++i)
2054 if (p_buffer[i] == c)
2089 template <
typename TOtherTraits>
2101 size_type
find_last_of(const_pointer s, size_type position, size_type n)
const
2108 position = etl::min(position,
size() - 1);
2110 const_reverse_iterator it =
rbegin() +
static_cast<difference_type
>(
size() - position - 1);
2112 while (it !=
rend())
2114 for (size_type j = 0; j < n; ++j)
2116 if (p_buffer[position] == s[j])
2141 position = etl::min(position,
size() - 1);
2143 const_reverse_iterator it =
rbegin() +
static_cast<difference_type
>(
size() - position - 1);
2145 while (it !=
rend())
2147 if (p_buffer[position] == c)
2184 template <
typename TOtherTraits>
2198 if (position <
size())
2200 for (size_type i = position; i <
size(); ++i)
2204 for (size_type j = 0; j < n; ++j)
2206 if (p_buffer[i] == s[j])
2229 if (position <
size())
2231 for (size_type i = position; i <
size(); ++i)
2233 if (*(p_buffer + i) != c)
2268 template <
typename TOtherTraits>
2287 position = etl::min(position,
size() - 1);
2289 const_reverse_iterator it =
rbegin() +
static_cast<difference_type
>(
size() - position - 1);
2291 while (it !=
rend())
2295 for (size_type j = 0; j < n; ++j)
2297 if (p_buffer[position] == s[j])
2325 position = etl::min(position,
size() - 1);
2327 const_reverse_iterator it =
rbegin() +
static_cast<difference_type
>(
size() - position - 1);
2329 while (it !=
rend())
2331 if (p_buffer[position] != c)
2369 template <
typename TOtherTraits>
2390 template <
typename TOtherTraits>
2413 append(size_type(1), rhs);
2418#if ETL_HAS_ISTRING_REPAIR
2422 virtual void repair() = 0;
2430#if ETL_HAS_STRING_TRUNCATION_CHECKS
2443#if ETL_HAS_STRING_TRUNCATION_CHECKS
2458 , p_buffer(p_buffer_)
2469#if ETL_HAS_STRING_TRUNCATION_CHECKS
2479 p_buffer = p_buffer_;
2492 if ((first == last) && (s == ETL_NULLPTR ||
length == 0U))
2509 const bool source_overlaps = (s != ETL_NULLPTR) && (s >= p_buffer) && (s < p_buffer +
current_size);
2511 if (source_overlaps)
2515 erase(first_, last_);
2517 if (s != ETL_NULLPTR &&
length != 0U)
2527 const size_type remove_index = size_type(first_ - p_buffer);
2528 const size_type remove_length = size_type(last_ - first_);
2529 const size_type free_space =
CAPACITY - remove_index;
2532 size_type insert_length = (s == ETL_NULLPTR) ? 0U :
length;
2535 if (insert_length > free_space)
2537 insert_length = free_space;
2541 size_type tail_index = remove_index + remove_length;
2543 size_type tail_space = free_space - insert_length;
2545#if ETL_HAS_STRING_TRUNCATION_CHECKS
2551 if (tail_space < tail_length)
2553 tail_length = tail_space;
2557 if (insert_length == remove_length)
2562 else if (insert_length > remove_length)
2566 etl::mem_move(&p_buffer[tail_index], tail_length, &p_buffer[remove_index + insert_length]);
2578 etl::mem_move(&p_buffer[tail_index], tail_length, &p_buffer[remove_index + insert_length]);
2581 current_size = remove_index + insert_length + tail_length;
2592 static int compare(const_pointer first1, const_pointer last1, const_pointer first2, const_pointer last2)
2594 typedef typename etl::make_unsigned<value_type>::type type;
2596 difference_type length1 = etl::distance(first1, last1);
2597 difference_type length2 = etl::distance(first2, last2);
2598 difference_type compare_length = etl::min(length1, length2);
2601 while (compare_length != 0)
2603 if (
static_cast<type
>(*first1) <
static_cast<type
>(*first2))
2608 else if (
static_cast<type
>(*first1) >
static_cast<type
>(*first2))
2620 if (length1 < length2)
2626 if (length1 > length2)
2641#if ETL_HAS_STRING_CLEAR_AFTER_USE
2662#if defined(ETL_POLYMORPHIC_STRINGS) || defined(ETL_POLYMORPHIC_CONTAINERS) || defined(ETL_ISTRING_REPAIR_ENABLE)
2673#if ETL_HAS_STRING_CLEAR_AFTER_USE
2688 return const_cast<iterator
>(itr);
2696 return (ptr >= p_buffer) && (ptr <= (p_buffer +
CAPACITY));
2705 template <
typename TIterator1>
2707 typename etl::enable_if< etl::is_pointer<typename etl::remove_reference<TIterator1>::type>::value
2710 copy_characters(TIterator1 from,
size_t n,
iterator to)
2721 template <
typename TIterator1>
2723 typename etl::enable_if< !(etl::is_pointer<typename etl::remove_reference<TIterator1>::type>::value
2726 copy_characters(TIterator1 from,
size_t n, iterator to)
2733 *to++ =
static_cast<value_type
>(*from++);
2745 template <
typename TIterator>
2746 typename etl::enable_if< !etl::is_pointer< typename etl::remove_reference<TIterator>::type>::value>::type
2747 append_impl(iterator position, TIterator first, TIterator last,
bool truncated,
bool secure)
2749 difference_type start = etl::distance(p_buffer, position);
2750 difference_type count = etl::distance(first, last);
2751 difference_type free_space = etl::distance(position, p_buffer +
CAPACITY);
2753#if ETL_IS_DEBUG_BUILD
2754 ETL_ASSERT(count >= 0, ETL_ERROR(string_iterator));
2757#if ETL_HAS_STRING_TRUNCATION_CHECKS
2760 #if ETL_HAS_ERROR_ON_STRING_TRUNCATION
2767#if ETL_HAS_STRING_CLEAR_AFTER_USE
2777 count = etl::min(count, free_space);
2778 copy_characters(first,
size_t(count), position);
2788 void append_impl(iterator position, const_pointer src,
bool truncated,
bool secure)
2790 if (src == ETL_NULLPTR)
2796 append_impl(position, src, get_string_length(src),
truncated, secure);
2802 void append_impl(iterator position, const_pointer src,
size_t length,
bool truncated,
bool secure)
2804 size_t start =
static_cast<size_t>(etl::distance(p_buffer, position));
2805 size_t free_space =
static_cast<size_t>(etl::distance(position, p_buffer +
CAPACITY));
2806 size_t count = etl::min(
length, free_space);
2808#if ETL_IS_DEBUG_BUILD
2817#if ETL_HAS_STRING_TRUNCATION_CHECKS
2819 #if ETL_HAS_ERROR_ON_STRING_TRUNCATION
2826#if ETL_HAS_STRING_CLEAR_AFTER_USE
2841 template <
typename TIterator>
2842 typename etl::enable_if< etl::is_pointer< typename etl::remove_reference<TIterator>::type>::value>::type
2843 append_impl(iterator position, TIterator first, TIterator last,
bool truncated,
bool secure)
2845 append_impl(position, first,
size_t(etl::distance(first, last)),
truncated ||
is_truncated(), secure);
2851 template <
typename TIterator>
2852 size_type find_impl(TIterator first, TIterator last, size_type sz, size_type pos = 0)
const
2854 if ((pos + sz) >
size())
2859 const_iterator iposition = etl::search(
begin() + pos,
end(), first, last);
2861 if (iposition ==
end())
2867 return static_cast<size_type
>(etl::distance(
begin(), iposition));
2874 template <
typename TIterator>
2875 size_type rfind_impl(TIterator rfirst, TIterator rlast, size_type sz, size_type pos = 0)
const
2889 const_reverse_iterator iposition = etl::search(
rbegin() +
static_cast<difference_type
>(pos),
rend(), rfirst, rlast);
2891 if (iposition ==
rend())
2897 return size() - sz -
static_cast<size_type
>(etl::distance(
rbegin(), iposition));
2904 template <
typename U>
2905 static typename etl::enable_if<
sizeof(U) ==
sizeof(
char),
size_t>::type get_string_length(
const U* str)
2907 return ::strlen(
reinterpret_cast<const char*
>(str));
2910#if ETL_USING_LIBC_WCHAR_H
2914 template <
typename U>
2915 static typename etl::enable_if<
sizeof(U) ==
sizeof(
wchar_t),
size_t>::type get_string_length(
const U* str)
2917 return ::wcslen(
reinterpret_cast<const wchar_t*
>(str));
2924 template <
typename U>
2926#if ETL_USING_LIBC_WCHAR_H
2927 typename etl::enable_if<(
sizeof(U) !=
sizeof(char)) && (
sizeof(U) !=
sizeof(
wchar_t)),
size_t>::type
2929 typename etl::enable_if<(
sizeof(U) !=
sizeof(char)),
size_t>::type
2931 get_string_length(
const U* str)
2933 if (str == ETL_NULLPTR)
2945 return size_t(
end - str) - 1;
2956 template <
typename T>
2969 template <
typename T>
2982 template <
typename T>
2995 template <
typename T>
2998 return !(lhs == rhs);
3008 template <
typename T>
3011 return !(lhs == rhs);
3021 template <
typename T>
3024 return !(lhs == rhs);
3034 template <
typename T>
3037 return etl::lexicographical_compare(lhs.
begin(), lhs.
end(), rhs.
begin(), rhs.
end());
3047 template <
typename T>
3060 template <
typename T>
3073 template <
typename T>
3086 template <
typename T>
3099 template <
typename T>
3113 template <
typename T>
3116 return !(lhs > rhs);
3127 template <
typename T>
3130 return !(lhs > rhs);
3141 template <
typename T>
3144 return !(lhs > rhs);
3155 template <
typename T>
3158 return !(lhs < rhs);
3169 template <
typename T>
3172 return !(lhs < rhs);
3183 template <
typename T>
3186 return !(lhs < rhs);
3196#if ETL_USING_STD_OSTREAM
3197 template <
typename T>
3200 os.write(str.
data(),
static_cast<std::streamsize
>(str.
size()));
String view.
Definition string_view.h:117
ETL_CONSTEXPR const_iterator cbegin() const ETL_NOEXCEPT
Returns a const iterator to the beginning of the array.
Definition string_view.h:239
ETL_CONSTEXPR size_t size() const ETL_NOEXCEPT
Returns the size of the array.
Definition string_view.h:307
ETL_CONSTEXPR const_reverse_iterator rend() const ETL_NOEXCEPT
Returns a const reverse iterator to the end of the array.
Definition string_view.h:279
ETL_CONSTEXPR const_pointer data() const ETL_NOEXCEPT
Returns a const pointer to the first element of the internal storage.
Definition string_view.h:223
ETL_CONSTEXPR const_iterator end() const ETL_NOEXCEPT
Returns a const iterator to the end of the array.
Definition string_view.h:247
ETL_CONSTEXPR const_iterator begin() const ETL_NOEXCEPT
Returns a const iterator to the beginning of the array.
Definition string_view.h:231
ETL_CONSTEXPR const_reverse_iterator rbegin() const ETL_NOEXCEPT
Returns a const reverse iterator to the reverse beginning of the array.
Definition string_view.h:263
Definition basic_string.h:335
int compare(size_type position, size_type length_, const ibasic_string &str) const
Compare position / length with string.
Definition basic_string.h:1911
ibasic_string & append(TIterator first, TIterator last)
Definition basic_string.h:854
size_type find_last_of(const_pointer s, size_type position=npos) const
Definition basic_string.h:2079
size_type rfind(const_pointer s, size_type position=npos) const
Definition basic_string.h:1517
ibasic_string & replace(const_iterator first, const_iterator last, const etl::basic_string_view< T, TOtherTraits > &view)
Definition basic_string.h:1735
etl::enable_if< etl::is_same< TIterator, const_pointer >::value, ibasic_string >::type & replace(const_iterator first, const_iterator last, TIterator s)
Replace characters from 'first' to 'last' with pointed to string.
Definition basic_string.h:1805
etl::ibasic_string< T > & insert(size_type position, const etl::ibasic_string< T > &str)
Definition basic_string.h:1174
ibasic_string & replace(const_iterator first, const_iterator last, const value_type(&literal)[Size])
Replace characters from 'first' 'last' with pointed to literal string.
Definition basic_string.h:1815
size_type find_last_not_of(const_pointer s, size_type position=npos) const
Definition basic_string.h:2258
size_type find(const_pointer s, size_type pos=0) const
Definition basic_string.h:1454
ibasic_string & operator=(const ibasic_string &rhs)
Assignment operator.
Definition basic_string.h:2346
ibasic_string & append(const ibasic_string &str, size_type subposition, size_type sublength=npos)
Definition basic_string.h:834
const_reverse_iterator rbegin() const
Definition basic_string.h:419
bool contains(const etl::ibasic_string< T > &str) const
Checks that the string is within this string.
Definition basic_string.h:1569
reference operator[](size_type i)
Definition basic_string.h:546
void assign(const etl::ibasic_string< T > &other, size_type subposition, size_type sublength)
Definition basic_string.h:686
etl::ibasic_string< T > & insert(size_type position, const etl::basic_string_view< T, TOtherTraits > &view, size_type subposition, size_type sublength)
Definition basic_string.h:1251
pointer data_end()
Definition basic_string.h:651
iterator erase(const_iterator first, const_iterator last)
Definition basic_string.h:1369
iterator insert(const_iterator position, TIterator first, TIterator last)
Definition basic_string.h:1071
bool is_within_buffer(const_pointer ptr) const
Checks if a pointer is within the buffer.
Definition basic_string.h:2694
bool contains(value_type c) const
Checks that character is within this string.
Definition basic_string.h:1594
size_type find_last_of(const ibasic_string< T > &str, size_type position=npos) const
Definition basic_string.h:2069
size_type find_first_of(value_type c, size_type position=0) const
Definition basic_string.h:2048
bool starts_with(const etl::ibasic_string< T > &str) const
Checks that the string is the start of this string.
Definition basic_string.h:1602
size_type find(T c, size_type position=0) const
Definition basic_string.h:1477
ibasic_string & replace(size_type position, size_type length_, const etl::basic_string_view< T, TOtherTraits > &view, size_type subposition, size_type sublength)
Definition basic_string.h:1761
bool ends_with(value_type c) const
Checks that the character is the end of this string.
Definition basic_string.h:1679
void pop_back()
Definition basic_string.h:809
size_type rfind(const ibasic_string< T > &str, size_type position=npos) const
Definition basic_string.h:1496
bool contains(const_pointer s) const
Checks that text is within this string.
Definition basic_string.h:1586
etl::ibasic_string< T > & insert(size_type position, const etl::basic_string_view< T, TOtherTraits > &view)
Definition basic_string.h:1200
void resize_and_overwrite(size_type new_size, TOperation operation)
Resizes the string and overwrites to data using the operation.
Definition basic_string.h:506
void initialize_free_space()
Clears the free space to string terminator value.
Definition basic_string.h:2428
ibasic_string & replace(size_type position, size_type length_, const_pointer s, size_type n)
Definition basic_string.h:1824
iterator to_iterator(const_iterator itr) const
Convert from const_iterator to iterator.
Definition basic_string.h:2686
ibasic_string & replace(size_type position, size_type length_, size_type n, value_type c)
Replace characters from 'position' of 'length' with 'n' copies of 'c'.
Definition basic_string.h:1837
const_reference operator[](size_type i) const
Definition basic_string.h:557
ibasic_string & replace(const_iterator first, const_iterator last, const ibasic_string &str)
Definition basic_string.h:1723
size_type find_first_of(const ibasic_string< T > &str, size_type position=0) const
Definition basic_string.h:1992
size_type find_first_of(const etl::basic_string_view< T, TOtherTraits > &view, size_type position=0) const
Definition basic_string.h:2013
const_reference back() const
Definition basic_string.h:623
void assign(const_pointer str, size_type n)
Definition basic_string.h:733
const_iterator begin() const
Definition basic_string.h:365
size_type find_last_of(const_pointer s, size_type position, size_type n) const
Definition basic_string.h:2101
bool ends_with(const etl::basic_string_view< T, TOtherTraits > &view) const
Checks that the view is the end of this string.
Definition basic_string.h:1651
reverse_iterator rbegin()
Definition basic_string.h:410
ibasic_string & replace(const_iterator first, const_iterator last, TIterator first_replace, TIterator last_replace)
Definition basic_string.h:1876
void resize(size_type new_size)
Definition basic_string.h:465
size_type find_last_not_of(const_pointer s, size_type position, size_type n) const
Definition basic_string.h:2280
ibasic_string & replace(size_type position, size_type length_, const etl::basic_string_view< T, TOtherTraits > &view)
Definition basic_string.h:1707
size_type find_first_not_of(const_pointer s, size_type position=0) const
Definition basic_string.h:2174
size_type rfind(T c, size_type position=npos) const
Definition basic_string.h:1545
etl::ibasic_string< T > & erase(size_type position, size_type length_=npos)
Definition basic_string.h:1314
int compare(const value_type *s) const
Compare with C string.
Definition basic_string.h:1966
int compare(size_type position, size_type length_, const_pointer s) const
Compare position / length with C string.
Definition basic_string.h:1974
iterator insert(const_iterator position, size_type n, T value)
Definition basic_string.h:981
ibasic_string & append(const etl::basic_string_view< T, TOtherTraits > &view)
Definition basic_string.h:889
const_reference at(size_type i) const
Definition basic_string.h:583
void assign(const etl::basic_string_view< T, TOtherTraits > &view)
Assigns values to the string from a view.
Definition basic_string.h:742
ibasic_string & operator+=(const_pointer rhs)
+= operator.
Definition basic_string.h:2401
void clear()
Clears the string.
Definition basic_string.h:775
int compare(size_type position, size_type length_, const ibasic_string &str, size_type subposition, size_type sublength) const
Compare position / length with string / subposition / sublength.
Definition basic_string.h:1933
reverse_iterator rend()
Definition basic_string.h:428
ibasic_string & operator=(const etl::basic_string_view< T, TOtherTraits > &view)
Assignment operator.
Definition basic_string.h:2370
size_type find_last_of(const etl::basic_string_view< T, TOtherTraits > &view, size_type position=npos) const
Definition basic_string.h:2090
iterator erase(iterator i_element)
Definition basic_string.h:1332
ibasic_string & append(const_pointer str, size_type n)
Definition basic_string.h:877
const_reverse_iterator crend() const
Definition basic_string.h:455
bool contains(const etl::basic_string_view< T, TOtherTraits > &view) const
Checks that the view is within this string.
Definition basic_string.h:1578
reference at(size_type i)
Definition basic_string.h:570
size_type rfind(const etl::basic_string_view< T, TOtherTraits > &view, size_type pos=0) const
Definition basic_string.h:1507
bool starts_with(value_type c) const
Checks that the character is the start of this string.
Definition basic_string.h:1629
int compare(const etl::basic_string_view< T, TOtherTraits > &view) const
Compare with etl::basic_string_view.
Definition basic_string.h:1903
~ibasic_string()
Destructor.
Definition basic_string.h:2671
size_type find(const_pointer s, size_type pos, size_type n) const
Definition basic_string.h:1467
size_type find_first_of(const_pointer s, size_type position=0) const
Definition basic_string.h:2002
ibasic_string & replace(size_type position, size_type length_, const ibasic_string &str, size_type subposition, size_type sublength)
Definition basic_string.h:1744
iterator begin()
Definition basic_string.h:356
iterator end()
Definition basic_string.h:374
ibasic_string & replace(const_iterator first, const_iterator last, size_type n, value_type c)
Replace characters from 'first' of 'last' with 'n' copies of 'c'.
Definition basic_string.h:1856
ibasic_string & replace(const_iterator first, const_iterator last, const_pointer s, size_type n)
Definition basic_string.h:1796
void assign(TIterator first, TIterator last)
Definition basic_string.h:712
etl::ibasic_string< T > & insert(size_type position, const etl::ibasic_string< T > &str, size_type subposition, size_type sublength)
Definition basic_string.h:1217
size_type find(const ibasic_string< T > &str, size_type pos=0) const
Definition basic_string.h:1433
void push_back(T value)
Definition basic_string.h:786
size_type find_first_not_of(const_pointer s, size_type position, size_type n) const
Definition basic_string.h:2196
const_reverse_iterator crbegin() const
Definition basic_string.h:446
iterator insert(const_iterator position, T value)
Definition basic_string.h:927
ibasic_string & operator=(const_pointer rhs)
Assignment operator.
Definition basic_string.h:2359
etl::ibasic_string< T > & insert(size_type position, const_pointer s, size_type n)
Definition basic_string.h:1286
ibasic_string & replace(size_type position, size_type length_, const ibasic_string &str)
Definition basic_string.h:1690
ibasic_string(T *p_buffer_, size_type MAX_SIZE_)
Constructor.
Definition basic_string.h:2456
bool ends_with(const_pointer s) const
Checks that the string is the end of this string.
Definition basic_string.h:1664
etl::ibasic_string< T > & insert(size_type position, size_type n, value_type c)
Definition basic_string.h:1300
const_reverse_iterator rend() const
Definition basic_string.h:437
size_type find_last_not_of(const ibasic_string< T > &str, size_type position=npos) const
Definition basic_string.h:2248
size_type find(const etl::basic_string_view< T, TOtherTraits > &view, size_type pos=0) const
Definition basic_string.h:1444
const_pointer data_end() const
Definition basic_string.h:660
void assign(const etl::ibasic_string< T > &other)
Definition basic_string.h:670
const_iterator cend() const
Definition basic_string.h:401
const_pointer c_str() const
Return a pointer to a C string.
Definition basic_string.h:1394
void resize(size_type new_size, T value)
Definition basic_string.h:476
ETL_CONSTEXPR const_pointer data() const
Definition basic_string.h:642
const_reference front() const
Definition basic_string.h:603
ibasic_string & operator+=(const etl::basic_string_view< T, TOtherTraits > &rhs)
+= operator.
Definition basic_string.h:2391
pointer data()
Definition basic_string.h:633
size_type find_first_not_of(value_type c, size_type position=0) const
Definition basic_string.h:2227
ibasic_string & append(const_pointer str)
Definition basic_string.h:865
ibasic_string & append(size_type n, T c)
Definition basic_string.h:901
size_type find_first_not_of(const ibasic_string< T > &str, size_type position=0) const
Definition basic_string.h:2164
size_type find_last_of(value_type c, size_type position=npos) const
Definition basic_string.h:2134
size_type copy(pointer dest, size_type count, size_type pos=0) const
Definition basic_string.h:1405
ibasic_string & append(const ibasic_string &str)
Definition basic_string.h:821
size_type find_last_not_of(const etl::basic_string_view< T, TOtherTraits > &view, size_type position=npos) const
Definition basic_string.h:2269
ibasic_string & operator+=(T rhs)
+= operator.
Definition basic_string.h:2411
ibasic_string & replace(size_type position, size_type length_, const_pointer s)
Replace characters from 'position' of 'length' with pointed to string.
Definition basic_string.h:1777
reference front()
Definition basic_string.h:593
reference back()
Definition basic_string.h:613
bool starts_with(const_pointer s) const
Checks that the string is the start of this string.
Definition basic_string.h:1619
const_iterator cbegin() const
Definition basic_string.h:392
size_type find_first_not_of(const etl::basic_string_view< T, TOtherTraits > &view, size_type position=0) const
Definition basic_string.h:2185
int compare(size_type position, size_type length_, const etl::basic_string_view< T, TOtherTraits > &view, size_type subposition, size_type sublength) const
Definition basic_string.h:1950
void assign(size_type n, T c)
Definition basic_string.h:753
void initialise()
Initialise the string.
Definition basic_string.h:2465
bool starts_with(const etl::basic_string_view< T, TOtherTraits > &view) const
Checks that the view is the start of this string.
Definition basic_string.h:1611
ibasic_string & operator+=(const ibasic_string &rhs)
+= operator.
Definition basic_string.h:2380
void trim_to_terminator()
Definition basic_string.h:2441
void uninitialized_resize(size_type new_size)
Definition basic_string.h:523
int compare(size_type position, size_type length_, const_pointer s, size_type n) const
Compare position / length with C string / n.
Definition basic_string.h:1982
size_type rfind(const_pointer s, size_type position, size_type length_) const
Definition basic_string.h:1532
bool ends_with(const etl::ibasic_string< T > &str) const
Checks that the string is the end of this string.
Definition basic_string.h:1637
size_type find_first_of(const_pointer s, size_type position, size_type n) const
Definition basic_string.h:2024
int compare(const ibasic_string &str) const
Compare with string.
Definition basic_string.h:1894
const_iterator end() const
Definition basic_string.h:383
iterator erase(const_iterator i_element)
Definition basic_string.h:1348
int compare(size_type position, size_type length_, const etl::basic_string_view< T, TOtherTraits > &view) const
Compare position / length with etl::basic_string_view.
Definition basic_string.h:1925
etl::ibasic_string< T > & insert(size_type position, const_pointer s)
Definition basic_string.h:1271
void assign(const_pointer str)
Definition basic_string.h:722
void fill(T value)
Definition basic_string.h:536
void repair_buffer(T *p_buffer_)
Fix the internal pointers after a low level memory copy.
Definition basic_string.h:2477
iterator insert(const_iterator position, const etl::basic_string_view< T, TOtherTraits > &view)
Definition basic_string.h:1164
Definition basic_string.h:146
Definition basic_string.h:169
void set_secure()
Sets the 'secure' flag to the requested state.
Definition basic_string.h:275
bool is_secure() const
Gets the 'secure' state flag.
Definition basic_string.h:284
const size_type CAPACITY
The maximum number of elements in the string.
Definition basic_string.h:320
bool full() const
Definition basic_string.h:205
~string_base()
Destructor.
Definition basic_string.h:317
ETL_DEPRECATED bool truncated() const
Definition basic_string.h:256
void set_truncated(bool status)
Sets the 'truncated' flag.
Definition basic_string.h:308
size_type max_size() const
Definition basic_string.h:223
string_base(size_type max_size_)
Constructor.
Definition basic_string.h:298
void clear_truncated()
Clears the 'truncated' flag.
Definition basic_string.h:265
size_type length() const
Definition basic_string.h:187
size_type current_size
The current number of elements in the string.
Definition basic_string.h:319
size_type available() const
Definition basic_string.h:232
bool empty() const
Definition basic_string.h:196
size_type capacity() const
Definition basic_string.h:214
bool is_truncated() const
Definition basic_string.h:241
size_type size() const
Definition basic_string.h:178
Definition basic_string.h:86
Definition basic_string.h:114
Definition basic_string.h:100
Definition basic_string.h:128
#define ETL_ASSERT(b, e)
Definition error_handler.h:511
ETL_EXCEPTION_CONSTEXPR exception(string_type reason_, string_type, numeric_type)
Constructor.
Definition exception.h:81
Definition exception.h:59
Definition integral_limits.h:517
void memory_clear_range(volatile T *begin, size_t n)
Definition memory.h:2986
Definition basic_string.h:142
ETL_CONSTEXPR14 bool operator==(const etl::array< T, SIZE > &lhs, const etl::array< T, SIZE > &rhs)
Definition array.h:1078
T * mem_move(const T *sb, const T *se, T *db) ETL_NOEXCEPT
Definition memory.h:3302
std::basic_ostream< T, std::char_traits< T > > & operator<<(std::basic_ostream< T, std::char_traits< T > > &os, const etl::ibasic_string< T > &str)
Definition basic_string.h:3198
etl::enable_if< etl::is_pointer< TPointer >::value &&!etl::is_const< TPointer >::value &&etl::is_integral< T >::value &&sizeof(T)==1, TPointer >::type mem_set(TPointer db, const TPointer de, T value) ETL_NOEXCEPT
Definition memory.h:3399
bool operator>(const etl::array< T, SIZE > &lhs, const etl::array< T, SIZE > &rhs)
Definition array.h:1130
bool operator>=(const etl::array< T, SIZE > &lhs, const etl::array< T, SIZE > &rhs)
Definition array.h:1144
ETL_CONSTEXPR14 bool operator!=(const etl::array< T, SIZE > &lhs, const etl::array< T, SIZE > &rhs)
Definition array.h:1090
T * mem_copy(const T *sb, const T *se, T *db) ETL_NOEXCEPT
Definition memory.h:3260
ETL_CONSTEXPR14 size_t strlen(const T *t) ETL_NOEXCEPT
Alternative strlen for all character types.
Definition char_traits.h:293
bool operator<(const etl::array< T, SIZE > &lhs, const etl::array< T, SIZE > &rhs)
Definition array.h:1103
bool operator<=(const etl::array< T, SIZE > &lhs, const etl::array< T, SIZE > &rhs)
Definition array.h:1117
iterator
Definition iterator.h:482
remove_pointer
Definition type_traits.h:147