libQuotient
A Qt library for building matrix clients
Quotient::FixedBufferBase Class Reference

Non-template base for owning byte span classes. More...

#include <e2ee_common.h>

Inheritance diagram for Quotient::FixedBufferBase:

Public Types

enum  InitOptions { Uninitialized , FillWithZeros , FillWithRandom }
 
using value_type = byte_t
 
using size_type = size_t
 

Public Member Functions

auto size () const
 
auto empty () const
 
void clear ()
 
QByteArray viewAsByteArray () const
 Access the bytes of the fixed buffer via QByteArray interface. More...
 
QByteArray copyToByteArray (QByteArray::size_type untilPos=-1) const
 Copy the contents of the buffer to a QByteArray. More...
 
QByteArray toBase64 () const
 
QByteArray toBase64 (QByteArray::Base64Options options) const
 
FixedBufferBaseoperator= (FixedBufferBase &&)=delete
 

Static Public Attributes

static constexpr auto TotalSecureHeapSize = 65'536
 

Protected Member Functions

 FixedBufferBase (size_type bufferSize, InitOptions options)
 
 ~FixedBufferBase ()
 
 FixedBufferBase (FixedBufferBase &&other)
 
void fillFrom (QByteArray &&source)
 
value_typedataForWriting ()
 
const value_typedata () const
 

Detailed Description

Non-template base for owning byte span classes.

Definition at line 144 of file e2ee_common.h.

Member Typedef Documentation

◆ size_type

Definition at line 149 of file e2ee_common.h.

◆ value_type

Definition at line 148 of file e2ee_common.h.

Member Enumeration Documentation

◆ InitOptions

Enumerator
Uninitialized 
FillWithZeros 
FillWithRandom 

Definition at line 146 of file e2ee_common.h.

Constructor & Destructor Documentation

◆ FixedBufferBase() [1/2]

Quotient::FixedBufferBase::FixedBufferBase ( size_type  bufferSize,
InitOptions  options 
)
protected

◆ ~FixedBufferBase()

Quotient::FixedBufferBase::~FixedBufferBase ( )
inlineprotected

Definition at line 196 of file e2ee_common.h.

◆ FixedBufferBase() [2/2]

Quotient::FixedBufferBase::FixedBufferBase ( FixedBufferBase &&  other)
inlineprotected

Definition at line 198 of file e2ee_common.h.

Member Function Documentation

◆ clear()

void Quotient::FixedBufferBase::clear ( )

◆ copyToByteArray()

QByteArray Quotient::FixedBufferBase::copyToByteArray ( QByteArray::size_type  untilPos = -1) const
inline

Copy the contents of the buffer to a QByteArray.

Unlike viewAsByteArray(), this function actually copies the buffer to non-secure memory.

Definition at line 178 of file e2ee_common.h.

◆ data()

const value_type* Quotient::FixedBufferBase::data ( ) const
inlineprotected

Definition at line 205 of file e2ee_common.h.

◆ dataForWriting()

value_type* Quotient::FixedBufferBase::dataForWriting ( )
inlineprotected

Definition at line 204 of file e2ee_common.h.

◆ empty()

auto Quotient::FixedBufferBase::empty ( ) const
inline

Definition at line 154 of file e2ee_common.h.

◆ fillFrom()

void Quotient::FixedBufferBase::fillFrom ( QByteArray &&  source)
protected

◆ operator=()

FixedBufferBase& Quotient::FixedBufferBase::operator= ( FixedBufferBase &&  )
delete

◆ size()

auto Quotient::FixedBufferBase::size ( ) const
inline

Definition at line 153 of file e2ee_common.h.

◆ toBase64() [1/2]

QByteArray Quotient::FixedBufferBase::toBase64 ( ) const
inline

Definition at line 185 of file e2ee_common.h.

◆ toBase64() [2/2]

QByteArray Quotient::FixedBufferBase::toBase64 ( QByteArray::Base64Options  options) const
inline

Definition at line 186 of file e2ee_common.h.

◆ viewAsByteArray()

QByteArray Quotient::FixedBufferBase::viewAsByteArray ( ) const
inline

Access the bytes of the fixed buffer via QByteArray interface.

This uses QByteArray::fromRawData() to create a QByteArray object that refers to the original fixed buffer, without copying.

Warning
the lifetime of the returned QByteArray should not exceed the lifetime of the underlying buffer; in particular, you should never try using the result of viewAsByteArray() as a return value of your function
See also
copyToByteArray

Definition at line 167 of file e2ee_common.h.

Member Data Documentation

◆ TotalSecureHeapSize

constexpr auto Quotient::FixedBufferBase::TotalSecureHeapSize = 65'536
staticconstexpr

Definition at line 151 of file e2ee_common.h.


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