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)
86 ::memmove(dst, src, count *
sizeof(char_type));
90 #if __cplusplus >= 202002L
91 static constexpr char_type* copy(char_type*
const dst,
const char_type*
const src,
const std::size_t count)
93 static char_type* copy(char_type*
const dst,
const char_type*
const src,
const std::size_t count)
96 ::memcpy(dst, src, count *
sizeof(char_type));
100 #if __cplusplus >= 201703L
101 static constexpr
int compare(
const char_type* left,
const char_type* right, std::size_t count)
103 static int compare(
const char_type* left,
const char_type* right, std::size_t count)
106 for (; count > 0; --count, ++left, ++right)
108 if (!eq(*left, *right))
110 return lt(*left, *right) ? -1 : 1;
117 #if __cplusplus >= 201703L
118 static constexpr std::size_t length(
const char_type* str)
120 static std::size_t length(
const char_type* str)
123 std::size_t count = 0;
133 #if __cplusplus >= 201703L
134 static constexpr
const char_type* find(
const char_type* str, std::size_t count,
const char_type& c)
136 static const char_type* find(
const char_type* str, std::size_t count,
const char_type& c)
139 for (; count > 0; --count, ++str)
150 #if __cplusplus >= 201103L
151 static constexpr char_type to_char_type(
const int_type i) noexcept
153 static char_type to_char_type(
const int_type i)
156 return static_cast<char_type
>(i);
159 #if __cplusplus >= 201103L
160 static constexpr int_type to_int_type(
const char_type c) noexcept
162 static int_type to_int_type(
const char_type c)
165 return static_cast<int_type
>(c);
168 #if __cplusplus >= 201103L
169 static constexpr
bool eq_int_type(
const int_type left,
const int_type right) noexcept
171 static bool eq_int_type(
const int_type left,
const int_type right)
174 return left == right;
177 #if __cplusplus >= 201103L
178 static constexpr int_type eof() noexcept
180 static int_type eof()
183 return static_cast<int_type
>(EOF);
186 #if __cplusplus >= 201103L
187 static constexpr int_type not_eof(
const int_type i) noexcept
189 static int_type not_eof(
const int_type i)
192 return i != eof() ? i : !eof();
200 #endif // PDFTRON_H_CPPCommonCharTraits