@@ -17,28 +17,28 @@ namespace unicode {
17
17
// /
18
18
// / \param octet
19
19
// / \return
20
- constexpr auto mask8 (uint8_t octet) {
20
+ constexpr inline auto mask8 (uint8_t octet) {
21
21
return static_cast <uint8_t >(0xffu & octet);
22
22
}
23
23
24
24
// /
25
25
// / \param value
26
26
// / \return
27
- constexpr auto mask16 (char16_t value) {
27
+ constexpr inline auto mask16 (char16_t value) {
28
28
return static_cast <char16_t >(u' \xff ff' & value);
29
29
}
30
30
31
31
// /
32
32
// / \param octet
33
33
// / \return
34
- constexpr auto is_trail (uint8_t octet) {
34
+ constexpr inline auto is_trail (uint8_t octet) {
35
35
return ((mask8 (octet) >> 6u ) == 0x2u );
36
36
}
37
37
38
38
// /
39
39
// / \param code_point
40
40
// / \return
41
- constexpr auto is_lead_surrogate (char16_t code_point) {
41
+ constexpr inline auto is_lead_surrogate (char16_t code_point) {
42
42
return
43
43
(code_point >= constants::surrogates::lead_min) &&
44
44
(code_point <= constants::surrogates::lead_max);
@@ -47,7 +47,7 @@ constexpr auto is_lead_surrogate(char16_t code_point) {
47
47
// /
48
48
// / \param value
49
49
// / \return
50
- constexpr auto is_trail_surrogate (char16_t value) {
50
+ constexpr inline auto is_trail_surrogate (char16_t value) {
51
51
return
52
52
(value >= constants::surrogates::trail_min) &&
53
53
(value <= constants::surrogates::trail_max);
@@ -56,7 +56,7 @@ constexpr auto is_trail_surrogate(char16_t value) {
56
56
// /
57
57
// / \param value
58
58
// / \return
59
- constexpr auto is_surrogate (char16_t value) {
59
+ constexpr inline auto is_surrogate (char16_t value) {
60
60
return
61
61
(value >= constants::surrogates::lead_min) &&
62
62
(value <= constants::surrogates::trail_max);
@@ -65,7 +65,7 @@ constexpr auto is_surrogate(char16_t value) {
65
65
// / Tests if the code point is a valid value.
66
66
// / \param code_point
67
67
// / \return \c true if it has a valid value, \c false otherwise
68
- constexpr auto is_valid_code_point (char32_t code_point) {
68
+ constexpr inline auto is_valid_code_point (char32_t code_point) {
69
69
return
70
70
(code_point <= constants::code_points::max) &&
71
71
!is_surrogate (static_cast <char16_t >(code_point));
@@ -74,7 +74,7 @@ constexpr auto is_valid_code_point(char32_t code_point) {
74
74
// / Returns the size of the sequnce given the lead octet value.
75
75
// / \param lead_value
76
76
// / \return 1, 2, 3 or 4
77
- constexpr auto sequence_length (uint8_t lead_value) {
77
+ constexpr inline auto sequence_length (uint8_t lead_value) {
78
78
auto lead = mask8 (lead_value);
79
79
if (lead < 0x80u ) {
80
80
return 1 ;
@@ -164,7 +164,7 @@ template<typename OctetIterator>
164
164
auto from_two_byte_sequence (OctetIterator first) -> tl::expected<sequence_state<OctetIterator>, std::error_code> {
165
165
using result_type = tl::expected<sequence_state<OctetIterator>, std::error_code>;
166
166
167
- auto set_code_point = [](auto state) -> result_type {
167
+ constexpr static auto set_code_point = [](auto state) -> result_type {
168
168
return update_value (
169
169
state,
170
170
((state.value << 6 ) & 0x7ff ) + (*state.it & 0x3f ));
@@ -186,13 +186,13 @@ template<typename OctetIterator>
186
186
auto from_three_byte_sequence (OctetIterator first) -> tl::expected<sequence_state<OctetIterator>, std::error_code> {
187
187
using result_type = tl::expected<sequence_state<OctetIterator>, std::error_code>;
188
188
189
- auto update_code_point_from_second_byte = [](auto state) -> result_type {
189
+ constexpr static auto update_code_point_from_second_byte = [](auto state) -> result_type {
190
190
return update_value (
191
191
state,
192
192
((state.value << 12 ) & 0xffff ) + ((mask8 (*state.it ) << 6 ) & 0xfff ));
193
193
};
194
194
195
- auto set_code_point = [](auto state) -> result_type {
195
+ constexpr static auto set_code_point = [](auto state) -> result_type {
196
196
return update_value (
197
197
state,
198
198
state.value + (*state.it & 0x3f ));
@@ -215,19 +215,19 @@ template<typename OctetIterator>
215
215
auto from_four_byte_sequence (OctetIterator first) -> tl::expected<sequence_state<OctetIterator>, std::error_code> {
216
216
using result_type = tl::expected<sequence_state<OctetIterator>, std::error_code>;
217
217
218
- auto update_code_point_from_second_byte = [](auto state) -> result_type {
218
+ constexpr static auto update_code_point_from_second_byte = [](auto state) -> result_type {
219
219
return update_value (
220
220
state,
221
221
((state.value << 18 ) & 0x1fffff ) + ((mask8 (*state.it ) << 12 ) & 0x3ffff ));
222
222
};
223
223
224
- auto update_code_point_from_third_byte = [](auto state) -> result_type {
224
+ constexpr static auto update_code_point_from_third_byte = [](auto state) -> result_type {
225
225
return update_value (
226
226
state,
227
227
state.value + ((mask8 (*state.it ) << 6 ) & 0xfff ));
228
228
};
229
229
230
- auto set_code_point = [](auto state) -> result_type {
230
+ constexpr static auto set_code_point = [](auto state) -> result_type {
231
231
return update_value (
232
232
state,
233
233
state.value + (*state.it & 0x3f ));
0 commit comments