BDE 4.14.0 Production release
|
#include <bdlbb_blob.h>
Public Member Functions | |
BlobBuffer () | |
BlobBuffer (const bsl::shared_ptr< char > &buffer, int size) | |
BlobBuffer (bslmf::MovableRef< bsl::shared_ptr< char > > buffer, int size) | |
BlobBuffer (const BlobBuffer &original) | |
BlobBuffer (bslmf::MovableRef< BlobBuffer > original) BSLS_KEYWORD_NOEXCEPT | |
~BlobBuffer () | |
Destroy this blob buffer. | |
BlobBuffer & | operator= (const BlobBuffer &rhs) |
BlobBuffer & | operator= (bslmf::MovableRef< BlobBuffer > rhs) |
void | reset () |
Reset this blob buffer to its default-constructed state. | |
void | reset (const bsl::shared_ptr< char > &buffer, int size) |
void | reset (bslmf::MovableRef< bsl::shared_ptr< char > > buffer, int size) |
bsl::shared_ptr< char > & | buffer () |
void | setSize (int size) |
void | swap (BlobBuffer &other) |
BlobBuffer | trim (int toSize) |
const bsl::shared_ptr< char > & | buffer () const |
char * | data () const |
int | size () const |
Return the size of the buffer represented by this object. | |
bsl::ostream & | print (bsl::ostream &stream, int level=0, int spacesPerLevel=4) const |
Friends | |
bool | operator== (const BlobBuffer &, const BlobBuffer &) |
bool | operator!= (const BlobBuffer &, const BlobBuffer &) |
BlobBuffer
is a simple in-core representation of a shared buffer. This class is exception-neutral with no guarantee of rollback: if an exception is thrown during the invocation of a method on a pre-existing instance, the container is left in a valid state, but its value is undefined. In no event is memory leaked.
See bdlbb_blob
|
inline |
Create a blob buffer representing a null buffer. Note that the size
and data
methods of a default-constructed blob buffer both return 0.
|
inline |
Create a blob buffer representing the specified buffer
of the specified size
. The behavior is undefined unless 0 <= size
and the buffer
refers to a continuous block of memory of at least size
bytes.
|
inline |
Create a blob buffer representing the specified moveable buffer
of the specified size
. The behavior is undefined unless 0 <= size
and the buffer
refers to a continuous block of memory of at least size
bytes.
|
inline |
Create a blob buffer having the same value as the specified original
blob buffer.
|
inline |
Create a blob buffer object having the same value as the specified original
object by moving the contents of original
to the newly-created object. original
is left in a valid but unspecified state.
|
inline |
|
inline |
Return a reference to the shared pointer to the modifiable buffer represented by this object.
|
inline |
Return a reference to the non-modifiable shared pointer to the buffer represented by this object.
|
inline |
Return the address of the modifiable buffer represented by this object.
BlobBuffer & bdlbb::BlobBuffer::operator= | ( | bslmf::MovableRef< BlobBuffer > | rhs | ) |
Assign to this object the value of the specified rhs
, and return a reference providing modifiable access to this object. The contents of rhs
are move-assigned to this object. rhs
is left in a valid but unspecified state.
BlobBuffer & bdlbb::BlobBuffer::operator= | ( | const BlobBuffer & | rhs | ) |
Assign to this blob buffer the value of the specified rhs
blob buffer, and return a reference to this modifiable blob buffer.
bsl::ostream & bdlbb::BlobBuffer::print | ( | bsl::ostream & | stream, |
int | level = 0 , |
||
int | spacesPerLevel = 4 |
||
) | const |
Format this object as a hexadecimal dump on the specified stream
, and return a reference to the modifiable stream
. Note that the optionally specified level
and spacesPerLevel
arguments are specified for interface compatibility only and are effectively ignored.
void bdlbb::BlobBuffer::reset | ( | ) |
void bdlbb::BlobBuffer::reset | ( | bslmf::MovableRef< bsl::shared_ptr< char > > | buffer, |
int | size | ||
) |
Set the buffer represented by this object to the specified moveable buffer
of the specified size
. The behavior is undefined unless 0 <= size
and the buffer
refers to a continuous block of memory of at least size
bytes.
void bdlbb::BlobBuffer::reset | ( | const bsl::shared_ptr< char > & | buffer, |
int | size | ||
) |
Set the buffer represented by this object to the specified buffer
of the specified size
. The behavior is undefined unless 0 <= size
and the buffer
refers to a continuous block of memory of at least size
bytes.
|
inline |
Set the size of this blob buffer to the specified size
. The behavior is undefined unless 0 <= size
and the capacity of the buffer returned by the buffer
method is at least size
bytes.
|
inline |
void bdlbb::BlobBuffer::swap | ( | BlobBuffer & | other | ) |
Efficiently exchange the value of this object with the value of the specified other
object. This method provides the no-throw exception-safety guarantee.
BlobBuffer bdlbb::BlobBuffer::trim | ( | int | toSize | ) |
Reduce this buffer to the specified toSize
and return the leftover. The behaviour is undefined unless '0 <= toSize && toSize <= size()'.
|
friend |
Return true
if the specified lhs
and rhs
blob buffers do not have the same value, and false
otherwise. Two blob buffers do not have the same value if they do not represent the same buffer of the same size.
|
friend |
Return true
if the specified lhs
and rhs
blob buffers have the same value, and false
otherwise. Two blob buffers have the same value if they represent the same buffer of the same size.