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