AUI Framework  develop
Cross-platform base for C++ UI apps
Loading...
Searching...
No Matches
AByteBufferView Class Reference

Acts like std::string_view but for AByteBuffer. More...

#include <AUI/Common/AByteBufferView.h>

Public Member Functions

 AByteBufferView (const char *buffer, size_t size) noexcept
 
 AByteBufferView (const std::string &string) noexcept
 
 AByteBufferView (std::string_view string) noexcept
 
template<typename T>
const T & at (size_t byteIndex) const noexcept
 Gets value of specified type by byte index relative to the beginning of internal buffer.
 
bool empty () const noexcept
 
AByteBufferView slice (std::size_t offset) const noexcept
 
AByteBufferView slice (std::size_t offset, std::size_t size) const noexcept
 
const char * data () const noexcept
 
size_t size () const noexcept
 
auto begin () const noexcept
 
auto end () const noexcept
 
AString toHexString () const
 
AString toBase64String () const
 
template<typename T>
const T & as () const
 
_unique< IInputStreamtoStream () const
 

Static Public Member Functions

static AByteBufferView fromRange (const char *begin, const char *end) noexcept
 
template<typename T>
static AByteBufferView fromRaw (const T &data) noexcept
 

Detailed Description

Acts like std::string_view but for AByteBuffer.

Note
don't use const reference of AByteBufferView. Passing by const reference forces compiler to use memory instead of registers.
AByteBufferView is intended for const access to memory data. As a function argument, consider to use std::span<std::byte> instead for non-const access.

Member Function Documentation

◆ at()

template<typename T>
const T & AByteBufferView::at ( size_t byteIndex) const
inlinenoexcept

Gets value of specified type by byte index relative to the beginning of internal buffer.

Template Parameters
Tdata type
Parameters
byteIndexbyte offset realtive to the beginning of internal buffer
Returns
data

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