sparrow 1.0.0
Loading...
Searching...
No Matches
sparrow::key_value_view_iterator Class Reference

Iterator for traversing key-value pairs in a binary metadata buffer. More...

#include <metadata.hpp>

Public Types

using value_type = metadata_pair_const_reference
 
using difference_type = std::ptrdiff_t
 
using pointer = value_type*
 
using reference = value_type&
 
using iterator_concept = std::forward_iterator_tag
 

Public Member Functions

SPARROW_API key_value_view_iterator (const key_value_view &parent, int32_t index)
 Constructs an iterator for the given view at the specified index.
 
SPARROW_API value_type operator* () const
 Dereferences the iterator to get the current key-value pair.
 
SPARROW_API key_value_view_iteratoroperator++ ()
 Advances the iterator to the next key-value pair.
 
SPARROW_API key_value_view_iterator operator++ (int)
 Advances the iterator to the next key-value pair.
 

Friends

bool operator== (const key_value_view_iterator &lhs, const key_value_view_iterator &rhs)
 Equality comparison operator for iterators.
 

Detailed Description

Iterator for traversing key-value pairs in a binary metadata buffer.

This iterator provides sequential access to metadata key-value pairs stored in a binary format. It lazily extracts pairs as the iteration progresses, making it memory-efficient for large metadata sets.

The iterator follows the input iterator concept, allowing single-pass traversal of the metadata pairs.

Precondition
The underlying buffer must remain valid for the iterator's lifetime
Postcondition
Iterator correctly extracts key-value pairs from binary format
Dereferencing provides valid metadata_pair objects

Definition at line 95 of file metadata.hpp.

Member Typedef Documentation

◆ difference_type

Definition at line 101 of file metadata.hpp.

◆ iterator_concept

using sparrow::key_value_view_iterator::iterator_concept = std::forward_iterator_tag

Definition at line 104 of file metadata.hpp.

◆ pointer

◆ reference

◆ value_type

Constructor & Destructor Documentation

◆ key_value_view_iterator()

SPARROW_API sparrow::key_value_view_iterator::key_value_view_iterator ( const key_value_view & parent,
int32_t index )

Constructs an iterator for the given view at the specified index.

Parameters
parentReference to the parent key_value_view
indexStarting index for the iterator
Precondition
parent must remain valid for the iterator's lifetime
index must be >= 0 and <= parent.size()
Postcondition
Iterator is positioned at the specified index
Iterator state is valid for dereferencing (if index < parent.size())
Here is the caller graph for this function:

Member Function Documentation

◆ operator*()

SPARROW_API value_type sparrow::key_value_view_iterator::operator* ( ) const

Dereferences the iterator to get the current key-value pair.

Returns
The metadata pair at the current iterator position
Precondition
Iterator must not be at end position
Current position must be valid within the metadata buffer
Postcondition
Returns valid metadata_pair with extracted key and value
Key and value string_views are valid while buffer remains unchanged

◆ operator++() [1/2]

SPARROW_API key_value_view_iterator & sparrow::key_value_view_iterator::operator++ ( )

Advances the iterator to the next key-value pair.

Returns
Reference to this iterator after advancement
Postcondition
Iterator is advanced to next position
Internal buffer pointer is correctly positioned for next extraction or past the end
Here is the call graph for this function:

◆ operator++() [2/2]

SPARROW_API key_value_view_iterator sparrow::key_value_view_iterator::operator++ ( int )

Advances the iterator to the next key-value pair.

Returns
Copy of this iterator before advancement
Postcondition
Iterator is advanced to next position
Internal buffer pointer is correctly positioned for next extraction or past the end
Here is the call graph for this function:

Friends And Related Symbol Documentation

◆ operator==

bool operator== ( const key_value_view_iterator & lhs,
const key_value_view_iterator & rhs )
friend

Equality comparison operator for iterators.

Parameters
lhsFirst iterator to compare
rhsSecond iterator to compare
Returns
true if iterators point to the same position
Postcondition
Two iterators are equal iff they have the same index

Definition at line 160 of file metadata.hpp.


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