|
35 | 35 |
|
36 | 36 | namespace jsoncons { |
37 | 37 |
|
38 | | -enum class staj_event_type |
| 38 | +enum class staj_event_type : uint8_t |
39 | 39 | { |
40 | | - begin_array, |
41 | | - end_array, |
42 | | - begin_object, |
43 | | - end_object, |
44 | | - key, |
45 | | - string_value, |
46 | | - byte_string_value, |
47 | | - null_value, |
48 | | - bool_value, |
49 | | - int64_value, |
50 | | - uint64_value, |
51 | | - half_value, |
52 | | - double_value |
| 40 | + key = 0, // 0000 |
| 41 | + string_value = 1, // 0001 |
| 42 | + byte_string_value = 2, // 0010 |
| 43 | + null_value = 3, // 0011 |
| 44 | + bool_value = 4, // 0100 |
| 45 | + int64_value = 5, // 0101 |
| 46 | + uint64_value = 6, // 0110 |
| 47 | + half_value = 8, // 1000 |
| 48 | + double_value = 9, // 1001 |
| 49 | + begin_object = 13, // 1101 |
| 50 | + end_object = 7, // 0111 |
| 51 | + begin_array = 14, // 1110 |
| 52 | + end_array = 15 // 1111 |
53 | 53 | }; |
54 | 54 |
|
| 55 | +inline bool is_begin_container(staj_event_type event_type) noexcept |
| 56 | +{ |
| 57 | + static const uint8_t mask{ uint8_t(staj_event_type::begin_object) & uint8_t(staj_event_type::begin_array) }; |
| 58 | + return (uint8_t(event_type) & mask) == mask; |
| 59 | +} |
| 60 | + |
| 61 | +inline bool is_end_container(staj_event_type event_type) noexcept |
| 62 | +{ |
| 63 | + static const uint8_t mask{ uint8_t(staj_event_type::end_object) & uint8_t(staj_event_type::end_array) }; |
| 64 | + return (uint8_t(event_type) & mask) == mask; |
| 65 | +} |
| 66 | + |
55 | 67 | template <typename CharT> |
56 | 68 | std::basic_ostream<CharT>& operator<<(std::basic_ostream<CharT>& os, staj_event_type tag) |
57 | 69 | { |
|
0 commit comments