Nebula
|
#include <blob.h>
The Util::Blob class encapsulates a chunk of raw memory into a C++ object which can be copied, compared and hashed.
Public Member Functions | |
void * | operator new (size_t s) |
override new operator | |
void | operator delete (void *ptr) |
override delete operator | |
Blob () | |
default constructor | |
Blob (std::nullptr_t t) | |
nullptr constructor | |
Blob (const void *ptr, size_t size) | |
constructor | |
Blob (size_t size) | |
reserve N bytes | |
Blob (const Blob &rhs) | |
copy constructor | |
Blob (Blob &&rhs) noexcept | |
move constructor | |
~Blob () | |
destructor | |
void | operator= (const Blob &rhs) |
assignment operator | |
void | operator= (Blob &&rhs) noexcept |
move assignment operator | |
bool | operator== (const Blob &rhs) const |
equality operator | |
bool | operator!= (const Blob &rhs) const |
inequality operator | |
bool | operator> (const Blob &rhs) const |
greater operator | |
bool | operator< (const Blob &rhs) const |
less operator | |
bool | operator>= (const Blob &rhs) const |
greater-equal operator | |
bool | operator<= (const Blob &rhs) const |
less-eqial operator | |
bool | IsValid () const |
return true if the blob contains data | |
void | Reserve (size_t size) |
reserve N bytes | |
void | Trim (size_t size) |
trim the size member (without re-allocating!) | |
void | Set (const void *ptr, size_t size) |
set blob contents | |
void | SetFromBase64 (const void *ptr, size_t size) |
set from base64 enconded | |
void | SetFromFile (const IO::URI &uri) |
set from file | |
void | SetChunk (const void *from, size_t size, size_t internalOffset) |
set chunk contents. Will allocate more memory if necessary. | |
void * | GetPtr () const |
get blob ptr | |
size_t | Size () const |
get blob size | |
uint32_t | HashCode () const |
get a hash code (compatible with Util::HashTable) | |
Util::Blob | GetBase64 () const |
get as base64 encoded | |
Static Public Member Functions | |
static void | Setup () |
static Setup method, called by SysFunc::Setup() | |
static void | Shutdown () |
static Shutdown method called by SysFunc::Exit | |
Private Member Functions | |
void | Delete () |
delete content | |
void | Allocate (size_t size) |
allocate internal buffer | |
void | Copy (const void *ptr, size_t size) |
copy content | |
void | GrowTo (size_t size) |
Increases allocated size without deleting existing data (reallocate and memcopy). | |
int | BinaryCompare (const Blob &rhs) const |
do a binary comparison between this and other blob | |
Private Attributes | |
void * | ptr = nullptr |
size_t | size = 0 |
size_t | allocSize = 0 |
Static Private Attributes | |
static Memory::Heap * | DataHeap = 0 |
|
inline |
default constructor
|
inline |
nullptr constructor
|
inline |
constructor
|
inline |
reserve N bytes
|
inline |
copy constructor
|
inlinenoexcept |
move constructor
|
inline |
destructor
|
inlineprivate |
allocate internal buffer
|
private |
do a binary comparison between this and other blob
Like strcmp(), but checks the blob contents.
|
inlineprivate |
copy content
|
inlineprivate |
delete content
Util::Blob Util::Blob::GetBase64 | ( | ) | const |
get as base64 encoded
creates a base64 copy blob
|
inline |
get blob ptr
|
inlineprivate |
Increases allocated size without deleting existing data (reallocate and memcopy).
|
inline |
get a hash code (compatible with Util::HashTable)
|
inline |
return true if the blob contains data
__forceinline void Util::Blob::operator delete | ( | void * | ptr | ) |
override delete operator
__forceinline void * Util::Blob::operator new | ( | size_t | s | ) |
override new operator
|
inline |
inequality operator
|
inline |
less operator
|
inline |
less-eqial operator
|
inlinenoexcept |
move assignment operator
|
inline |
assignment operator
|
inline |
equality operator
|
inline |
greater operator
|
inline |
greater-equal operator
|
inline |
reserve N bytes
|
inline |
set blob contents
|
inline |
set chunk contents. Will allocate more memory if necessary.
void Util::Blob::SetFromBase64 | ( | const void * | ptr, |
size_t | size ) |
set from base64 enconded
decodes a base64 buffer and stores it inside
void Util::Blob::SetFromFile | ( | const IO::URI & | uri | ) |
set from file
loads binary from file
|
inlinestatic |
static Setup method, called by SysFunc::Setup()
|
inlinestatic |
static Shutdown method called by SysFunc::Exit
|
inline |
get blob size
|
inline |
trim the size member (without re-allocating!)
|
private |
|
staticprivate |
|
private |
|
private |