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

Three-valued outcome of a feed call (spec §7). More...

#include <sofab.hpp>

Public Member Functions

size_t skipped () const noexcept
 
 operator bool () const noexcept
 
bool ok () const noexcept
 
DecodeStatus status () const noexcept
 
bool complete () const noexcept
 
bool incomplete () const noexcept
 
bool invalid () const noexcept
 
bool limitExceeded () const noexcept
 
bool invalidArgument () const noexcept
 
Error code () const noexcept
 
bool operator== (Error e) const noexcept
 
bool operator!= (Error e) const noexcept
 

Friends

class IStreamImpl
 

Detailed Description

Three-valued outcome of a feed call (spec §7).

Carries one of Error::None (COMPLETE), Error::Incomplete (INCOMPLETE) or Error::InvalidMessage (INVALID). Read it either as an Error code, as a DecodeStatus via status, or through the boolean predicates complete / incomplete / invalid. incomplete is not an error — the bytes merely end mid-field and more may follow.

Definition at line 2936 of file sofab.hpp.

Member Function Documentation

◆ code()

Error sofab::IStreamImpl::Result::code ( ) const
inlinenoexcept

◆ complete()

bool sofab::IStreamImpl::Result::complete ( ) const
inlinenoexcept
Returns
true if the consumed bytes end exactly at a field boundary (COMPLETE).

Definition at line 2984 of file sofab.hpp.

◆ incomplete()

bool sofab::IStreamImpl::Result::incomplete ( ) const
inlinenoexcept
Returns
true if the bytes end mid-field / with an open sequence (INCOMPLETE). Not an error.

Definition at line 2986 of file sofab.hpp.

◆ invalid()

bool sofab::IStreamImpl::Result::invalid ( ) const
inlinenoexcept
Returns
true if the bytes are malformed (INVALID). False for a limitExceeded result — a policy cap is not wire malformation.

Definition at line 2991 of file sofab.hpp.

◆ invalidArgument()

bool sofab::IStreamImpl::Result::invalidArgument ( ) const
inlinenoexcept
Returns
true if a well-formed value did not fit the destination the caller handed over (§6.3's third tier, §6.6.3). Distinct from both invalid and limitExceeded.

Definition at line 2999 of file sofab.hpp.

◆ limitExceeded()

bool sofab::IStreamImpl::Result::limitExceeded ( ) const
inlinenoexcept
Returns
true if a receiver-side limit (§6.2.1) was exceeded. Distinct from invalid.

Definition at line 2993 of file sofab.hpp.

◆ ok()

bool sofab::IStreamImpl::Result::ok ( ) const
inlinenoexcept
Returns
true only for COMPLETE; false for both incomplete and invalid.

Definition at line 2954 of file sofab.hpp.

◆ operator bool()

sofab::IStreamImpl::Result::operator bool ( ) const
inlineexplicitnoexcept
Returns
true only for COMPLETE — the bytes end exactly at a field boundary.

Definition at line 2952 of file sofab.hpp.

◆ operator!=()

bool sofab::IStreamImpl::Result::operator!= ( Error  e) const
inlinenoexcept
Returns
true if the status code differs from e.

Definition at line 3005 of file sofab.hpp.

◆ operator==()

bool sofab::IStreamImpl::Result::operator== ( Error  e) const
inlinenoexcept
Returns
true if the status code equals e.

Definition at line 3003 of file sofab.hpp.

◆ skipped()

size_t sofab::IStreamImpl::Result::skipped ( ) const
inlinenoexcept
Returns
Fields skipped because their wire tag contradicted the type the callback asked for (MESSAGE_SPEC §7.3) — see IStreamImpl::skipped. A diagnostic: a non-zero count on a COMPLETE result means the message was valid but did not match this schema everywhere.

Definition at line 2950 of file sofab.hpp.

◆ status()

DecodeStatus sofab::IStreamImpl::Result::status ( ) const
inlinenoexcept
Returns
The outcome as a DecodeStatus, one value per category. The three §5.2 wire outcomes map to DecodeStatus::Complete / DecodeStatus::Incomplete / DecodeStatus::Invalid; the two non-wire refusals keep values of their own — DecodeStatus::LimitExceeded for a receiver policy cap (§6.2.1) and DecodeStatus::InvalidArgument for a destination too short for a well-formed value (§6.6.3).
Note
These used to fold into as a coarse fallback", which §6.2.1 forbids outright — "An implementation MUST NOT report it as InvalidMessage and MUST NOT fold it into the INVALID outcome" — and status() is the accessor a caller writing switch (r.status()) reaches for first (A2-0024).

Definition at line 2972 of file sofab.hpp.

Friends And Related Symbol Documentation

◆ IStreamImpl

friend class IStreamImpl
friend

Definition at line 2940 of file sofab.hpp.


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