simdjson 4.1.0
Ridiculously Fast JSON
Loading...
Searching...
No Matches
simdjson::dom::object::iterator Class Reference

Public Types

using value_type = const key_value_pair
 
using difference_type = std::ptrdiff_t
 
using pointer = void
 
using reference = value_type
 
using iterator_category = std::forward_iterator_tag
 

Public Member Functions

reference operator* () const noexcept
 Get the actual key/value pair.
 
iteratoroperator++ () noexcept
 Get the next key/value pair.
 
iterator operator++ (int) noexcept
 Get the next key/value pair.
 
bool operator!= (const iterator &other) const noexcept
 Check if these values come from the same place in the JSON.
 
bool operator== (const iterator &other) const noexcept
 
bool operator< (const iterator &other) const noexcept
 
bool operator<= (const iterator &other) const noexcept
 
bool operator>= (const iterator &other) const noexcept
 
bool operator> (const iterator &other) const noexcept
 
std::string_view key () const noexcept
 Get the key of this key/value pair.
 
uint32_t key_length () const noexcept
 Get the length (in bytes) of the key in this key/value pair.
 
bool key_equals (std::string_view o) const noexcept
 Returns true if the key in this key/value pair is equal to the provided string_view.
 
bool key_equals_case_insensitive (std::string_view o) const noexcept
 Returns true if the key in this key/value pair is equal to the provided string_view in a case-insensitive manner.
 
const char * key_c_str () const noexcept
 Get the key of this key/value pair.
 
element value () const noexcept
 Get the value of this key/value pair.
 
 iterator (const iterator &) noexcept=default
 
iteratoroperator= (const iterator &) noexcept=default
 

Detailed Description

Definition at line 21 of file object.h.

Member Typedef Documentation

◆ difference_type

using simdjson::dom::object::iterator::difference_type = std::ptrdiff_t

Definition at line 24 of file object.h.

◆ iterator_category

using simdjson::dom::object::iterator::iterator_category = std::forward_iterator_tag

Definition at line 27 of file object.h.

◆ pointer

using simdjson::dom::object::iterator::pointer = void

Definition at line 25 of file object.h.

◆ reference

◆ value_type

Definition at line 23 of file object.h.

Member Function Documentation

◆ key()

std::string_view simdjson::dom::object::iterator::key ( ) const
inlinenoexcept

Get the key of this key/value pair.

Definition at line 319 of file object-inl.h.

◆ key_c_str()

const char * simdjson::dom::object::iterator::key_c_str ( ) const
inlinenoexcept

Get the key of this key/value pair.

Definition at line 325 of file object-inl.h.

◆ key_equals()

bool simdjson::dom::object::iterator::key_equals ( std::string_view  o) const
inlinenoexcept

Returns true if the key in this key/value pair is equal to the provided string_view.

Design notes: Instead of constructing a string_view and then comparing it with a user-provided strings, it is probably more performant to have dedicated functions taking as a parameter the string we want to compare against and return true when they are equal.

That avoids the creation of a temporary std::string_view. Though it is possible for the compiler to avoid entirely any overhead due to string_view, relying too much on compiler magic is problematic: compiler magic sometimes fail, and then what do you do? Also, enticing users to rely on high-performance function is probably better on the long run.

Definition at line 345 of file object-inl.h.

◆ key_equals_case_insensitive()

bool simdjson::dom::object::iterator::key_equals_case_insensitive ( std::string_view  o) const
inlinenoexcept

Returns true if the key in this key/value pair is equal to the provided string_view in a case-insensitive manner.

Case comparisons may only be handled correctly for ASCII strings.

Definition at line 356 of file object-inl.h.

◆ key_length()

uint32_t simdjson::dom::object::iterator::key_length ( ) const
inlinenoexcept

Get the length (in bytes) of the key in this key/value pair.

You should expect this function to be faster than key().size().

Definition at line 322 of file object-inl.h.

◆ operator!=()

bool simdjson::dom::object::iterator::operator!= ( const iterator other) const
inlinenoexcept

Check if these values come from the same place in the JSON.

Part of the std::iterator interface.

Definition at line 291 of file object-inl.h.

◆ operator*()

const key_value_pair simdjson::dom::object::iterator::operator* ( ) const
inlinenoexcept

Get the actual key/value pair.

Definition at line 288 of file object-inl.h.

◆ operator++() [1/2]

object::iterator & simdjson::dom::object::iterator::operator++ ( )
inlinenoexcept

Get the next key/value pair.

Part of the std::iterator interface.

Definition at line 309 of file object-inl.h.

◆ operator++() [2/2]

object::iterator simdjson::dom::object::iterator::operator++ ( int  )
inlinenoexcept

Get the next key/value pair.

Part of the std::iterator interface.

Definition at line 314 of file object-inl.h.

◆ operator<()

bool simdjson::dom::object::iterator::operator< ( const iterator other) const
inlinenoexcept

Definition at line 297 of file object-inl.h.

◆ operator<=()

bool simdjson::dom::object::iterator::operator<= ( const iterator other) const
inlinenoexcept

Definition at line 300 of file object-inl.h.

◆ operator==()

bool simdjson::dom::object::iterator::operator== ( const iterator other) const
inlinenoexcept

Definition at line 294 of file object-inl.h.

◆ operator>()

bool simdjson::dom::object::iterator::operator> ( const iterator other) const
inlinenoexcept

Definition at line 306 of file object-inl.h.

◆ operator>=()

bool simdjson::dom::object::iterator::operator>= ( const iterator other) const
inlinenoexcept

Definition at line 303 of file object-inl.h.

◆ value()

element simdjson::dom::object::iterator::value ( ) const
inlinenoexcept

Get the value of this key/value pair.

Definition at line 328 of file object-inl.h.


The documentation for this class was generated from the following files: