A BlobLite holds a pointer to an immutable pre-allocated buffer and its length This is like a JavaScript string which is a pointer to an immutable string. More...
#include <blob-lite.hpp>
Public Member Functions | |
BlobLite () | |
Create a BlobLite where the buf and size are 0. | |
BlobLite (const uint8_t *buf, size_t size) | |
Create a BlobLite with the given buffer. More... | |
const uint8_t * | buf () const |
Return buf given to the constructor. | |
size_t | size () const |
Return size given to the constructor. | |
bool | isNull () const |
Check if the array pointer is null. More... | |
Static Public Member Functions | |
static BlobLite & | downCast (ndn_Blob &blob) |
Downcast the reference to the ndn_Blob struct to a BlobLite. More... | |
static const BlobLite & | downCast (const ndn_Blob &blob) |
A BlobLite holds a pointer to an immutable pre-allocated buffer and its length This is like a JavaScript string which is a pointer to an immutable string.
It is OK to pass a pointer to the string because the new owner can't change the bytes of the string. However, like a JavaScript string, it is possible to change the pointer, and so this does allow the copy constructor and assignment to change the pointer. Also remember that the pointer can be null.
ndn::BlobLite::BlobLite | ( | const uint8_t * | buf, |
size_t | size | ||
) |
Create a BlobLite with the given buffer.
buf | The pre-allocated buffer for the value, or 0 for none. |
size | The number of bytes in buf. |
|
inline |
Check if the array pointer is null.