6 #ifndef PDFTRON_H_CPPCommonCharTraits
7 #define PDFTRON_H_CPPCommonCharTraits
9 #if defined(__apple_build_version__) && __apple_build_version__ >= 17000013
21 struct char_traits<pdftron::
UInt32>
23 #if __cplusplus >= 201103L
25 using int_type =
unsigned int;
26 using off_type = std::streamoff;
27 using pos_type = std::fpos<std::mbstate_t>;
28 using state_type = std::mbstate_t;
31 typedef unsigned int int_type;
32 typedef std::streamoff off_type;
33 typedef std::fpos<std::mbstate_t> pos_type;
34 typedef std::mbstate_t state_type;
37 #if __cplusplus >= 201703L
38 static constexpr
void assign(char_type& left,
const char_type& right) noexcept
39 #elif __cplusplus >= 201103L
40 static void assign(char_type& left,
const char_type& right) noexcept
42 static void assign(char_type& left,
const char_type& right)
48 #if __cplusplus >= 202002L
49 static constexpr char_type* assign(char_type*
const first, std::size_t count,
const char_type c)
51 static char_type* assign(char_type*
const first, std::size_t count,
const char_type c)
54 for (char_type* next = first; count > 0; --count, ++next)
62 #if __cplusplus >= 201103L
63 static constexpr
bool eq(
const char_type left,
const char_type right) noexcept
65 static bool eq(
const char_type left,
const char_type right)
71 #if __cplusplus >= 201103L
72 static constexpr
bool lt(
const char_type left,
const char_type right) noexcept
74 static bool lt(
const char_type left,
const char_type right)
80 #if __cplusplus >= 202002L
81 static constexpr char_type* move(char_type*
const dst,
const char_type*
const src,
const std::size_t count)
83 static char_type* move(char_type*
const dst,
const char_type*
const src,
const std::size_t count)
88 for(std::size_t i = 0; i < count; ++i)
95 for(std::size_t i = count; i-- > 0;)
104 #if __cplusplus >= 202002L
105 static constexpr char_type* copy(char_type*
const dst,
const char_type*
const src,
const std::size_t count)
107 static char_type* copy(char_type*
const dst,
const char_type*
const src,
const std::size_t count)
110 for(std::size_t i = 0; i < count; ++i)
118 #if __cplusplus >= 201703L
119 static constexpr
int compare(
const char_type* left,
const char_type* right, std::size_t count)
121 static int compare(
const char_type* left,
const char_type* right, std::size_t count)
124 for (; count > 0; --count, ++left, ++right)
126 if (!eq(*left, *right))
128 return lt(*left, *right) ? -1 : 1;
135 #if __cplusplus >= 201703L
136 static constexpr std::size_t length(
const char_type* str)
138 static std::size_t length(
const char_type* str)
141 std::size_t count = 0;
152 #if __cplusplus >= 201703L
153 static constexpr
const char_type* find(
const char_type* str, std::size_t count,
const char_type& c)
155 static const char_type* find(
const char_type* str, std::size_t count,
const char_type& c)
158 for (; count > 0; --count, ++str)
169 #if __cplusplus >= 201103L
170 static constexpr char_type to_char_type(
const int_type i) noexcept
172 static char_type to_char_type(
const int_type i)
175 return static_cast<char_type
>(i);
178 #if __cplusplus >= 201103L
179 static constexpr int_type to_int_type(
const char_type c) noexcept
181 static int_type to_int_type(
const char_type c)
184 return static_cast<int_type
>(c);
187 #if __cplusplus >= 201103L
188 static constexpr
bool eq_int_type(
const int_type left,
const int_type right) noexcept
190 static bool eq_int_type(
const int_type left,
const int_type right)
193 return left == right;
196 #if __cplusplus >= 201103L
197 static constexpr int_type eof() noexcept
199 static int_type eof()
202 return static_cast<int_type
>(EOF);
205 #if __cplusplus >= 201103L
206 static constexpr int_type not_eof(
const int_type i) noexcept
208 static int_type not_eof(
const int_type i)
211 return i != eof() ? i : !eof();
219 #endif // PDFTRON_H_CPPCommonCharTraits