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