|
MayaFlux 1.0.0
Digital-First Multimedia Processing Framework
|
Splits a byte stream into lines, whatever the chunking. More...
#include <Framing.hpp>
Public Member Functions | |
| size_t | buffered () const noexcept |
| Bytes held for a line that has not ended. | |
| LineFramer (size_t max_line=default_max_line) noexcept | |
| template<MessageSink Sink> | |
| FrameReport | push (Message bytes, Sink &&sink) |
| void | reset () noexcept |
| Drop any partial line and any discard in progress. | |
Static Private Member Functions | |
| template<typename Sink> | |
| static void | deliver (Message line, Sink &sink, FrameReport &report) |
Private Attributes | |
| bool | m_discarding { false } |
| size_t | m_max_line |
| std::vector< uint8_t > | m_pending |
Splits a byte stream into lines, whatever the chunking.
A message is the bytes before each LF with one trailing CR removed. Empty lines are delivered as empty messages. A line longer than max_line, counted raw before the LF and including any CR, is dropped and the framer resumes after the next LF. A line that sits whole inside one push is delivered as a view into the input with no copy.
A payload that contains LF cannot be carried, so multi-line text needs LengthPrefixFramer.
Not thread safe: one thread at a time per framer.
Definition at line 112 of file Framing.hpp.