fb-cpp 0.0.1
A modern C++ wrapper for the Firebird database API
Loading...
Searching...
No Matches
fbcpp::Blob Class Referencefinal

Provides read and write access to Firebird blobs. More...

#include <Blob.h>

Public Member Functions

 Blob (Attachment &attachment, Transaction &transaction, const BlobOptions &options={})
 Creates and opens a new blob for writing.
 
 Blob (Attachment &attachment, Transaction &transaction, const BlobId &blobId, const BlobOptions &options={})
 Opens an existing blob for reading or writing.
 
 Blob (Blob &&o) noexcept
 Transfers blob ownership from another instance.
 
Bloboperator= (Blob &&)=delete
 Move assignment is not supported.
 
 Blob (const Blob &)=delete
 Copy construction is not supported.
 
Bloboperator= (const Blob &)=delete
 Copy assignment is not supported.
 
 ~Blob () noexcept
 Automatically closes the blob if still open.
 
bool isValid () const noexcept
 Returns whether the blob handle is valid.
 
const BlobIdgetId () const noexcept
 Provides access to the current blob identifier.
 
unsigned getLength ()
 Retrieves the length of the blob in bytes.
 
FbRef< fb::IBlob > getHandle () noexcept
 Exposes the underlying Firebird blob handle.
 
unsigned read (std::span< std::byte > buffer)
 Reads data from the blob into the provided buffer.
 
unsigned read (std::span< char > buffer)
 Reads data from the blob into the provided buffer.
 
unsigned readSegment (std::span< std::byte > buffer)
 Reads a single segment from the blob into the provided buffer.
 
unsigned readSegment (std::span< char > buffer)
 Reads a single segment from the blob into the provided buffer.
 
void write (std::span< const std::byte > buffer)
 Writes data from the buffer into the blob.
 
void write (std::span< const char > buffer)
 Writes data from the buffer into the blob.
 
void writeSegment (std::span< const std::byte > buffer)
 Writes a single segment from the buffer into the blob.
 
void writeSegment (std::span< const char > buffer)
 Writes a single segment from the buffer into the blob.
 
int seek (BlobSeekMode mode, int offset)
 Repositions the blob read/write cursor.
 
void cancel ()
 Cancels any changes performed on the blob and releases the handle.
 
void close ()
 Closes the blob and finalizes any pending changes.
 

Detailed Description

Provides read and write access to Firebird blobs.

Definition at line 242 of file Blob.h.

Constructor & Destructor Documentation

◆ Blob() [1/3]

Blob::Blob ( Attachment attachment,
Transaction transaction,
const BlobOptions options = {} 
)

Creates and opens a new blob for writing.

Definition at line 38 of file Blob.cpp.

◆ Blob() [2/3]

Blob::Blob ( Attachment attachment,
Transaction transaction,
const BlobId blobId,
const BlobOptions options = {} 
)

Opens an existing blob for reading or writing.

Definition at line 53 of file Blob.cpp.

◆ Blob() [3/3]

fbcpp::Blob::Blob ( Blob &&  o)
inlinenoexcept

Transfers blob ownership from another instance.

Definition at line 258 of file Blob.h.

◆ ~Blob()

fbcpp::Blob::~Blob ( )
inlinenoexcept

Automatically closes the blob if still open.

Definition at line 286 of file Blob.h.

Member Function Documentation

◆ cancel()

void Blob::cancel ( )

Cancels any changes performed on the blob and releases the handle.

Definition at line 238 of file Blob.cpp.

◆ close()

void Blob::close ( )

Closes the blob and finalizes any pending changes.

Definition at line 246 of file Blob.cpp.

◆ getHandle()

FbRef< fb::IBlob > fbcpp::Blob::getHandle ( )
inlinenoexcept

Exposes the underlying Firebird blob handle.

Definition at line 326 of file Blob.h.

◆ getId()

const BlobId & fbcpp::Blob::getId ( ) const
inlinenoexcept

Provides access to the current blob identifier.

Definition at line 313 of file Blob.h.

◆ getLength()

unsigned Blob::getLength ( )

Retrieves the length of the blob in bytes.

Definition at line 106 of file Blob.cpp.

◆ isValid()

bool fbcpp::Blob::isValid ( ) const
inlinenoexcept

Returns whether the blob handle is valid.

Definition at line 305 of file Blob.h.

◆ read() [1/2]

unsigned fbcpp::Blob::read ( std::span< char >  buffer)
inline

Reads data from the blob into the provided buffer.

Definition at line 339 of file Blob.h.

◆ read() [2/2]

unsigned Blob::read ( std::span< std::byte >  buffer)

Reads data from the blob into the provided buffer.

Definition at line 156 of file Blob.cpp.

◆ readSegment() [1/2]

unsigned fbcpp::Blob::readSegment ( std::span< char >  buffer)
inline

Reads a single segment from the blob into the provided buffer.

Definition at line 352 of file Blob.h.

◆ readSegment() [2/2]

unsigned Blob::readSegment ( std::span< std::byte >  buffer)

Reads a single segment from the blob into the provided buffer.

Definition at line 179 of file Blob.cpp.

◆ seek()

int Blob::seek ( BlobSeekMode  mode,
int  offset 
)

Repositions the blob read/write cursor.

Definition at line 232 of file Blob.cpp.

◆ write() [1/2]

void fbcpp::Blob::write ( std::span< const char >  buffer)
inline

Writes data from the buffer into the blob.

Definition at line 365 of file Blob.h.

◆ write() [2/2]

void Blob::write ( std::span< const std::byte >  buffer)

Writes data from the buffer into the blob.

Definition at line 204 of file Blob.cpp.

◆ writeSegment() [1/2]

void fbcpp::Blob::writeSegment ( std::span< const char >  buffer)
inline

Writes a single segment from the buffer into the blob.

Definition at line 378 of file Blob.h.

◆ writeSegment() [2/2]

void Blob::writeSegment ( std::span< const std::byte >  buffer)

Writes a single segment from the buffer into the blob.

Definition at line 219 of file Blob.cpp.


The documentation for this class was generated from the following files: