SLProject  4.2.000
A platform independent 3D computer graphics framework for desktop OS, Android, iOS and online in web browsers
SLIOBuffer Struct Reference

Utility struct that holds a pointer and its length. More...

#include <SLFileStorage.h>

Public Member Functions

SLIOBuffer copy ()
 Creates a copy of the data in the buffer. More...
 
void deallocate ()
 Deallocates the data owned by the buffer. More...
 

Public Attributes

unsigned char * data
 
size_t size
 

Detailed Description

Utility struct that holds a pointer and its length.

Definition at line 27 of file SLFileStorage.h.

Member Function Documentation

◆ copy()

SLIOBuffer SLIOBuffer::copy ( )

Creates a copy of the data in the buffer.

Definition at line 25 of file SLFileStorage.cpp.

26 {
27  unsigned char* copy = new unsigned char[size];
28  std::memcpy(copy, data, size);
29  return SLIOBuffer{copy, size};
30 }
Utility struct that holds a pointer and its length.
Definition: SLFileStorage.h:28
SLIOBuffer copy()
Creates a copy of the data in the buffer.
size_t size
Definition: SLFileStorage.h:30
unsigned char * data
Definition: SLFileStorage.h:29

◆ deallocate()

void SLIOBuffer::deallocate ( )

Deallocates the data owned by the buffer.

Definition at line 33 of file SLFileStorage.cpp.

34 {
35  delete[] data;
36 }

Member Data Documentation

◆ data

unsigned char* SLIOBuffer::data

Definition at line 29 of file SLFileStorage.h.

◆ size

size_t SLIOBuffer::size

Definition at line 30 of file SLFileStorage.h.


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