31#ifndef ETL_CHAR_TRAITS_INCLUDED
32#define ETL_CHAR_TRAITS_INCLUDED
52 typedef char char_type;
54 typedef long long off_type;
55 typedef size_t pos_type;
56 typedef char state_type;
61 typedef wchar_t char_type;
62 typedef uint_least16_t int_type;
63 typedef long long off_type;
64 typedef size_t pos_type;
65 typedef char state_type;
71 typedef char8_t char_type;
72 typedef unsigned int int_type;
73 typedef long long off_type;
74 typedef size_t pos_type;
75 typedef char state_type;
81 typedef char16_t char_type;
82 typedef uint_least16_t int_type;
83 typedef long long off_type;
84 typedef size_t pos_type;
85 typedef char state_type;
90 typedef char32_t char_type;
91 typedef uint_least32_t int_type;
92 typedef long long off_type;
93 typedef size_t pos_type;
94 typedef char state_type;
110 static ETL_CONSTEXPR
bool eq(char_type a, char_type b)
116 static ETL_CONSTEXPR
bool lt(char_type a, char_type b)
122 static ETL_CONSTEXPR14
size_t length(
const char_type* str)
138 ETL_CONSTEXPR14
static size_t length(
const char_type* str,
size_t max_length)
144 while ((count < max_length) && (*str++ != 0))
154 static ETL_CONSTEXPR14
void assign(char_type& r,
const char_type& c)
160 static ETL_CONSTEXPR14 char_type* assign(char_type* p,
size_t n, char_type c)
162 if (p != ETL_NULLPTR)
164 etl::fill_n(p, n, c);
171 static ETL_CONSTEXPR14 char_type* move(char_type* dst,
const char_type* src,
size_t count)
173 if ((dst < src) || (dst > (src + count)))
175 etl::copy_n(src, count, dst);
179 etl::copy_n(ETL_OR_STD::reverse_iterator<const char_type*>(src + count),
181 ETL_OR_STD::reverse_iterator<char_type*>(dst + count));
188 static ETL_CONSTEXPR14 char_type* copy(char_type* dst,
const char_type* src,
size_t count)
190 etl::copy_n(src, count, dst);
196 static ETL_CONSTEXPR14
int compare(
const char_type* s1,
const char_type* s2,
size_t count)
198 for (
size_t i = 0UL; i < count; ++i)
200 const char_type c1 = *s1++;
201 const char_type c2 = *s2++;
217 static ETL_CONSTEXPR14
const char_type* find(
const char_type* p,
size_t count,
const char_type& ch)
219 for (
size_t i = 0UL; i < count; ++i)
233 static ETL_CONSTEXPR char_type to_char_type(int_type c)
235 return static_cast<char_type
>(c);
239 static ETL_CONSTEXPR int_type to_int_type(char_type c)
241 return static_cast<int_type
>(c);
245 static ETL_CONSTEXPR
bool eq_int_type(int_type c1, int_type c2)
251 static ETL_CONSTEXPR int_type eof()
257 static ETL_CONSTEXPR int_type not_eof(int_type e)
259 return (e == eof()) ? eof() - 1 : e;
266 template <
typename T>
275 template <
typename T>
276 size_t strlen(
const T* t,
size_t max_length)
bitset_ext
Definition: absolute.h:38
ETL_CONSTEXPR size_t strlen(const T *t)
Alternative strlen for all character types.
Definition: char_traits.h:267
Definition: char_traits.h:48
Character traits for any character type.
Definition: char_traits.h:102