C++ Actor Framework 1.0.0
Loading...
Searching...
No Matches
caf::net::web_socket::frame Class Reference

An implicitly shared type for passing along WebSocket data frames, i.e., text or binary frames. More...

#include <frame.hpp>

Public Member Functions

 frame (intrusive_ptr< chunk::data > ptr)
 
 frame (const_byte_span buffer)
 
 frame (caf::span< const const_byte_span > buffers)
 
 frame (std::string_view text)
 
 frame (caf::span< const std::string_view > texts)
 
 operator bool () const noexcept
 Checks whether get_data() returns a non-null pointer.
 
size_t size () const noexcept
 Returns the number of bytes stored in this frame.
 
bool empty () const noexcept
 Returns whether size() == 0.
 
void swap (frame &other) noexcept
 Exchange the contents of this frame with other.
 
const_byte_span bytes () const noexcept
 Returns the bytes stored in this frame.
 
const intrusive_ptr< chunk::data > & get_data () const &noexcept
 Returns the underlying data object.
 
intrusive_ptr< chunk::data > && get_data () &&noexcept
 Returns the underlying data object.
 
bool is_binary () const noexcept
 Checks whether this frame contains binary data.
 
bool is_text () const noexcept
 Checks whether this frame contains text data.
 
const_byte_span as_binary () const noexcept
 Returns the bytes stored in this frame.
 
std::string_view as_text () const noexcept
 Returns the characters stored in this frame.
 
chunk as_chunk () const &noexcept
 Converts this frame to a chunk.
 
chunk as_chunk () &&noexcept
 Converts this frame to a chunk.
 

Static Public Member Functions

static frame from_chunk (chunk ch)
 Creates a frame from a chunk.
 
template<class... Buffers>
static frame from_buffers (const Buffers &... buffers)
 Creates a frame from one or more buffers.
 
template<class... Texts>
static frame from_strings (const Texts &... texts)
 Creates a frame from one or more strings.
 

Detailed Description

An implicitly shared type for passing along WebSocket data frames, i.e., text or binary frames.


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