| 1 | #ifndef SIMDJSON_INTERNAL_TAPE_REF_H |
|---|---|
| 2 | #define SIMDJSON_INTERNAL_TAPE_REF_H |
| 3 | |
| 4 | #include "simdjson/internal/tape_type.h" |
| 5 | |
| 6 | namespace simdjson { |
| 7 | |
| 8 | namespace dom { |
| 9 | class document; |
| 10 | } |
| 11 | |
| 12 | namespace internal { |
| 13 | |
| 14 | constexpr const uint64_t JSON_VALUE_MASK = 0x00FFFFFFFFFFFFFF; |
| 15 | constexpr const uint32_t JSON_COUNT_MASK = 0xFFFFFF; |
| 16 | |
| 17 | /** |
| 18 | * A reference to an element on the tape. Internal only. |
| 19 | */ |
| 20 | class tape_ref { |
| 21 | public: |
| 22 | simdjson_inline tape_ref() noexcept; |
| 23 | simdjson_inline tape_ref(const dom::document *doc, size_t json_index) noexcept; |
| 24 | inline size_t after_element() const noexcept; |
| 25 | simdjson_inline tape_type tape_ref_type() const noexcept; |
| 26 | simdjson_inline uint64_t tape_value() const noexcept; |
| 27 | simdjson_inline bool is_double() const noexcept; |
| 28 | simdjson_inline bool is_int64() const noexcept; |
| 29 | simdjson_inline bool is_uint64() const noexcept; |
| 30 | simdjson_inline bool is_false() const noexcept; |
| 31 | simdjson_inline bool is_true() const noexcept; |
| 32 | simdjson_inline bool is_null_on_tape() const noexcept;// different name to avoid clash with is_null. |
| 33 | simdjson_inline uint32_t matching_brace_index() const noexcept; |
| 34 | simdjson_inline uint32_t scope_count() const noexcept; |
| 35 | template<typename T> |
| 36 | simdjson_inline T next_tape_value() const noexcept; |
| 37 | simdjson_inline uint32_t get_string_length() const noexcept; |
| 38 | simdjson_inline const char * get_c_str() const noexcept; |
| 39 | inline std::string_view get_string_view() const noexcept; |
| 40 | simdjson_inline bool is_document_root() const noexcept; |
| 41 | simdjson_inline bool usable() const noexcept; |
| 42 | |
| 43 | /** The document this element references. */ |
| 44 | const dom::document *doc; |
| 45 | |
| 46 | /** The index of this element on `doc.tape[]` */ |
| 47 | size_t json_index; |
| 48 | }; |
| 49 | |
| 50 | } // namespace internal |
| 51 | } // namespace simdjson |
| 52 | |
| 53 | #endif // SIMDJSON_INTERNAL_TAPE_REF_H |
| 54 |