Cogs.Core
Public Member Functions | Public Attributes | List of all members
Cogs::Core::ResourceBuffer Struct Reference

Public Member Functions

uint8_t * data ()
 Returns pointer to start of buffer data. Requires non-empty Contents.
 
const uint8_t * data () const
 Returns pointer to start of buffer data. Requires non-empty Contents.
 
size_t size () const
 
bool empty () const
 
std::string_view toStringView () const
 Return contents as a std::string_view.
 
template<class T >
std::span< const T > toSpan (size_t offset=0) const
 

Public Attributes

std::shared_ptr< Memory::MemoryBufferbuffer
 Actual resource contents. Prefer using access methods.
 

Detailed Description

Definition at line 21 of file ResourceStore.h.

Member Function Documentation

◆ data() [1/2]

uint8_t * Cogs::Core::ResourceBuffer::data ( )
inline

Returns pointer to start of buffer data. Requires non-empty Contents.

Definition at line 25 of file ResourceStore.h.

References buffer.

◆ data() [2/2]

const uint8_t * Cogs::Core::ResourceBuffer::data ( ) const
inline

Returns pointer to start of buffer data. Requires non-empty Contents.

Definition at line 29 of file ResourceStore.h.

References buffer.

◆ empty()

bool Cogs::Core::ResourceBuffer::empty ( ) const
inline

Definition at line 35 of file ResourceStore.h.

◆ size()

size_t Cogs::Core::ResourceBuffer::size ( ) const
inline

Definition at line 32 of file ResourceStore.h.

◆ toSpan()

template<class T >
std::span< const T > Cogs::Core::ResourceBuffer::toSpan ( size_t  offset = 0) const
inline

Return contents as a span of given type. Length is truncated if length of data not a multiple of span type. Example: resourceBuffer.to_span<int>();

Parameters
offset- Optional BYTE offset into buffer. Client is responsible to ensure alignment.
Returns
Created span

Definition at line 50 of file ResourceStore.h.

References buffer.

◆ toStringView()

std::string_view Cogs::Core::ResourceBuffer::toStringView ( ) const
inline

Return contents as a std::string_view.

Definition at line 39 of file ResourceStore.h.

References buffer.

Member Data Documentation

◆ buffer

std::shared_ptr<Memory::MemoryBuffer> Cogs::Core::ResourceBuffer::buffer

Actual resource contents. Prefer using access methods.

Definition at line 61 of file ResourceStore.h.

Referenced by data(), toSpan(), and toStringView().


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