31 #ifndef ETL_CHAR_TRAITS_INCLUDED
32 #define ETL_CHAR_TRAITS_INCLUDED
47 #if (ETL_NO_LARGE_CHAR_SUPPORT)
48 typedef int16_t char16_t;
49 typedef int32_t char32_t;
58 typedef char char_type;
60 typedef long long off_type;
61 typedef size_t pos_type;
62 typedef char state_type;
67 typedef wchar_t char_type;
68 typedef wchar_t int_type;
69 typedef long long off_type;
70 typedef size_t pos_type;
71 typedef char state_type;
76 typedef char16_t char_type;
77 typedef uint_least16_t int_type;
78 typedef long long off_type;
79 typedef size_t pos_type;
80 typedef char state_type;
85 typedef char32_t char_type;
86 typedef uint_least32_t int_type;
87 typedef long long off_type;
88 typedef size_t pos_type;
89 typedef char state_type;
105 ETL_CONSTEXPR
static bool eq(char_type a, char_type b)
111 ETL_CONSTEXPR
static bool lt(char_type a, char_type b)
117 ETL_CONSTEXPR14
static size_t length(
const char_type* str)
133 static void assign(char_type& r,
const char_type& c)
139 static char_type* assign(char_type* p,
size_t n, char_type c)
143 etl::fill_n(p, n, c);
150 static char_type* move(char_type* dest,
const char_type* src,
size_t count)
152 if ((dest < src) || (dest > (src + count)))
154 etl::copy_n(src, src + count, dest);
158 etl::copy_n(ETL_OR_STD::reverse_iterator<char_type*>(src + count),
160 ETL_OR_STD::reverse_iterator<char_type*>(dest + count));
167 static char_type* copy(char_type* dest,
const char_type* src,
size_t count)
169 etl::copy_n(src, src + count, dest);
175 static int compare(
const char_type* s1,
const char_type* s2,
size_t count)
177 for (
size_t i = 0; i < count; ++i)
196 static const char_type* find(
const char_type* p,
size_t count,
const char_type& ch)
198 for (
size_t i = 0; i < count; ++i)
212 static char_type to_char_type(int_type c)
214 return static_cast<char_type
>(c);
218 static int_type to_int_type(char_type c)
220 return static_cast<int_type
>(c);
224 static bool eq_int_type(int_type c1, int_type c2)
230 static int_type eof()
236 static int_type not_eof(int_type e)
238 return (e == eof()) ? eof() - 1 : e;
246 template <
typename T>
Definition: absolute.h:37
size_t strlen(const T *t)
Alternative strlen for all character types.
Definition: char_traits.h:247
Definition: char_traits.h:54
Character traits for any character type.
Definition: char_traits.h:97