SofaBuffers C++ 0.12.0
Pure-C++20 SofaBuffers — API Documentation
Loading...
Searching...
No Matches
sofab::OStreamImpl::PendingRun Class Reference

The held-back sequence run: ids of the innermost open sequences whose header has not been written yet (sequenceBeginLazy). More...

#include <sofab.hpp>

Public Member Functions

bool empty () const noexcept
 
size_t size () const noexcept
 
sofab::id operator[] (size_t i) const noexcept
 
bool push (sofab::id v) noexcept
 Hold back one more id (the new innermost open sequence).
 
void pop () noexcept
 Drop the innermost held-back id — its sequence got no content.
 
void clear () noexcept
 Forget the whole run (it has just been written out).
 

Detailed Description

The held-back sequence run: ids of the innermost open sequences whose header has not been written yet (sequenceBeginLazy).

Always a contiguous suffix of the open sequences — writing any field commits the whole run at once — and it is fixed-size state (CORELIB_PLAN §6.6.2), sized to its full extent when the stream is constructed: "The pending run is fixed-size state (§6.6.2): at most <tt>MAX_DEPTH</tt> ids, <strong>sized at construction</strong>. An implementation <strong>MUST</strong> hold back to the full <tt>MAX_DEPTH</tt> (§6.2) and is thereby canonical at every depth." (§6.0.1, "How deep the hold-back reaches"). MAX_DEPTH is what bounds the nesting, hence the run; sequenceBeginLazy refuses past it, so the array below can never be outrun.

Definition at line 1393 of file sofab.hpp.

Member Function Documentation

◆ clear()

void sofab::OStreamImpl::PendingRun::clear ( )
inlinenoexcept

Forget the whole run (it has just been written out).

Definition at line 1435 of file sofab.hpp.

◆ empty()

bool sofab::OStreamImpl::PendingRun::empty ( ) const
inlinenoexcept
Returns
true while no header is held back.

Definition at line 1407 of file sofab.hpp.

◆ operator[]()

sofab::id sofab::OStreamImpl::PendingRun::operator[] ( size_t  i) const
inlinenoexcept
Returns
The i-th held-back id, outermost first.

Definition at line 1411 of file sofab.hpp.

◆ pop()

void sofab::OStreamImpl::PendingRun::pop ( )
inlinenoexcept

Drop the innermost held-back id — its sequence got no content.

Definition at line 1429 of file sofab.hpp.

◆ push()

bool sofab::OStreamImpl::PendingRun::push ( sofab::id  v)
inlinenoexcept

Hold back one more id (the new innermost open sequence).

Allocates nothing — the run was sized at construction. The false return is kept for the caller that already handles it, but it can only be reached by a push past MAX_DEPTH, which OStreamImpl::sequenceBeginLazy rejects one step earlier.

Returns
true if the id is held back, false if the run is full.

Definition at line 1422 of file sofab.hpp.

◆ size()

size_t sofab::OStreamImpl::PendingRun::size ( ) const
inlinenoexcept
Returns
How many headers are held back.

Definition at line 1409 of file sofab.hpp.


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