Blob Class Reference

#include <Pt/Db/Blob.h>

Copy-on-write binary large object. More...

Public Member Functions

 Blob ()
 Creates an empty blob.
 Blob (const char *data, std::size_t len)
 Copies len bytes from data.
 Blob (IBlob *b)
 Takes ownership of the implementation b.
void assign (const char *data, std::size_t len)
 Replaces the bytes with len bytes from data.
bool operator== (const Blob &b) const
 Returns true if both blobs contain the same data.
bool operator!= (const Blob &b) const
 Returns true if the blobs do not contain the same data.
const char * data () const
 Returns a pointer to the data, or 0 if empty.
std::size_t size () const
 Returns the size of the data.

Detailed Description

Blob holds binary column data as a shared, copy-on-write value. The default constructor is empty. The data constructor copies len bytes from data. The IBlob constructor takes ownership of a custom implementation.

assign() replaces the bytes and copies on write when the value is shared. data() returns the bytes or 0 when empty. size() is the length. Equality compares the bytes.