1 | namespace simdjson { |
---|---|
2 | namespace SIMDJSON_IMPLEMENTATION { |
3 | namespace ondemand { |
4 | |
5 | simdjson_inline token_iterator::token_iterator( |
6 | const uint8_t *_buf, |
7 | token_position position |
8 | ) noexcept : buf{_buf}, _position{position} |
9 | { |
10 | } |
11 | |
12 | simdjson_inline uint32_t token_iterator::current_offset() const noexcept { |
13 | return *(_position); |
14 | } |
15 | |
16 | |
17 | simdjson_inline const uint8_t *token_iterator::return_current_and_advance() noexcept { |
18 | return &buf[*(_position++)]; |
19 | } |
20 | |
21 | simdjson_inline const uint8_t *token_iterator::peek(token_position position) const noexcept { |
22 | return &buf[*position]; |
23 | } |
24 | simdjson_inline uint32_t token_iterator::peek_index(token_position position) const noexcept { |
25 | return *position; |
26 | } |
27 | simdjson_inline uint32_t token_iterator::peek_length(token_position position) const noexcept { |
28 | return *(position+1) - *position; |
29 | } |
30 | |
31 | simdjson_inline const uint8_t *token_iterator::peek(int32_t delta) const noexcept { |
32 | return &buf[*(_position+delta)]; |
33 | } |
34 | simdjson_inline uint32_t token_iterator::peek_index(int32_t delta) const noexcept { |
35 | return *(_position+delta); |
36 | } |
37 | simdjson_inline uint32_t token_iterator::peek_length(int32_t delta) const noexcept { |
38 | return *(_position+delta+1) - *(_position+delta); |
39 | } |
40 | |
41 | simdjson_inline token_position token_iterator::position() const noexcept { |
42 | return _position; |
43 | } |
44 | simdjson_inline void token_iterator::set_position(token_position target_position) noexcept { |
45 | _position = target_position; |
46 | } |
47 | |
48 | simdjson_inline bool token_iterator::operator==(const token_iterator &other) const noexcept { |
49 | return _position == other._position; |
50 | } |
51 | simdjson_inline bool token_iterator::operator!=(const token_iterator &other) const noexcept { |
52 | return _position != other._position; |
53 | } |
54 | simdjson_inline bool token_iterator::operator>(const token_iterator &other) const noexcept { |
55 | return _position > other._position; |
56 | } |
57 | simdjson_inline bool token_iterator::operator>=(const token_iterator &other) const noexcept { |
58 | return _position >= other._position; |
59 | } |
60 | simdjson_inline bool token_iterator::operator<(const token_iterator &other) const noexcept { |
61 | return _position < other._position; |
62 | } |
63 | simdjson_inline bool token_iterator::operator<=(const token_iterator &other) const noexcept { |
64 | return _position <= other._position; |
65 | } |
66 | |
67 | } // namespace ondemand |
68 | } // namespace SIMDJSON_IMPLEMENTATION |
69 | } // namespace simdjson |
70 | |
71 | namespace simdjson { |
72 | |
73 | simdjson_inline simdjson_result<SIMDJSON_IMPLEMENTATION::ondemand::token_iterator>::simdjson_result(SIMDJSON_IMPLEMENTATION::ondemand::token_iterator &&value) noexcept |
74 | : implementation_simdjson_result_base<SIMDJSON_IMPLEMENTATION::ondemand::token_iterator>(std::forward<SIMDJSON_IMPLEMENTATION::ondemand::token_iterator>(t&: value)) {} |
75 | simdjson_inline simdjson_result<SIMDJSON_IMPLEMENTATION::ondemand::token_iterator>::simdjson_result(error_code error) noexcept |
76 | : implementation_simdjson_result_base<SIMDJSON_IMPLEMENTATION::ondemand::token_iterator>(error) {} |
77 | |
78 | } // namespace simdjson |
79 |