Protocol for text messages delimited by a specific character, yielding a specified string type.
More...
|
|
| basic_text ()=delete |
| | Default constructor (deleted)
|
| | basic_text (_IO_ &io) noexcept |
| | Constructor with I/O reference.
|
| void | onMessage (std::size_t size) noexcept |
| | Process a received message.
|
|
| byte_terminated ()=delete |
| | Default constructor (deleted)
|
|
virtual | ~byte_terminated ()=default |
| | Virtual destructor.
|
| std::size_t | shiftSize (std::size_t const size) const noexcept |
| | Calculates the message size without the delimiter.
|
| std::size_t | getMessageSize () noexcept final |
| | Determines the size of the next complete message.
|
| void | reset () noexcept final |
| | Resets the protocol state.
|
| virtual | ~IProtocol ()=default |
| | Virtual destructor.
|
| bool | ok () const noexcept |
| | Checks if the protocol is in a valid operational state.
|
| void | not_ok () noexcept |
| | Marks the protocol as being in an invalid or non-operational state.
|
| void | set_should_flush (bool should_flush) noexcept |
| | Sets the flag indicating whether the protocol should flush the input buffer after processing a message.
|
| bool | should_flush () const noexcept |
| | Gets the flag indicating whether the protocol should flush the input buffer after processing a message.
|
template<typename _IO_, typename _StringTrait, char _Sep = '\0'>
class qb::protocol::text::basic_text< _IO_, _StringTrait, _Sep >
Protocol for text messages delimited by a specific character, yielding a specified string type.
This class implements a protocol to handle text messages that are delimited by a specific character (_Sep). It uses the qb::protocol::base::byte_terminated protocol as its base and, upon receiving a complete message, provides a message struct containing the raw data, its size, and the text formatted as _StringTrait (e.g., std::string, std::string_view) to the I/O component's handler.
- Template Parameters
-
| _IO_ | The I/O component type that will use this protocol. |
| _StringTrait | The type of string to produce (e.g., std::string, std::string_view). |
| _Sep | The delimiter character. Defaults to '\0'. |