|
| Blob () |
| Create a new Blob with a null pointer.
|
|
| Blob (const uint8_t *value, size_t valueLength) |
| Create a new Blob with an immutable copy of the given array. More...
|
|
| Blob (const std::vector< uint8_t > &value) |
| Create a new Blob with an immutable copy of the array in the given vector. More...
|
|
| Blob (const struct ndn_Blob &blobStruct) |
| Create a new Blob with an immutable copy of the array in the given Blob struct. More...
|
|
| Blob (const BlobLite &blobLite) |
| Create a new Blob with an immutable copy of the array in blobLite. More...
|
|
| Blob (const Blob &blob) |
| Create a new Blob and take another pointer to the given blob's buffer. More...
|
|
| Blob (const ptr_lib::shared_ptr< std::vector< uint8_t > > &value, bool copy) |
| Create a new Blob to point to an existing byte array. More...
|
|
| Blob (const ptr_lib::shared_ptr< const std::vector< uint8_t > > &value, bool copy) |
|
DEPRECATED_IN_NDN_CPP | Blob (const ptr_lib::shared_ptr< std::vector< uint8_t > > &value) |
| Create a new Blob to point to an existing byte array. More...
|
|
DEPRECATED_IN_NDN_CPP | Blob (const ptr_lib::shared_ptr< const std::vector< uint8_t > > &value) |
|
size_t | size () const |
| Return the length of the immutable byte array.
|
|
const uint8_t * | buf () const |
| Return a const pointer to the first byte of the immutable byte array, or 0 if the pointer is null.
|
|
bool | isNull () const |
| Check if the array pointer is null. More...
|
|
std::string | toHex () const |
| Return the hex representation of the bytes in array. More...
|
|
std::string | toRawStr () const |
| Return the bytes of the byte array as a raw str of the same length. More...
|
|
bool | equals (const Blob &other) const |
| Check if the value of this Blob equals the other blob. More...
|
|
void | get (struct ndn_Blob &blobStruct) const |
| Set the blobStruct to point to this Blob's byte array, without copying any memory. More...
|
|
| operator const BlobLite () const |
|
A Blob holds a pointer to an immutable byte array implemented as const std::vector<uint8_t>.
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. (Note that we could have made Blob derive directly from vector<uint8_t> and then explicitly use a pointer to it like Blob, but this does not enforce immutability because we can't declare Blob as derived from const vector<uint8_t>.)