MongoDB C++ Driver mongocxx-3.11.0
Loading...
Searching...
No Matches
mongocxx::v_noabi::gridfs::uploader Class Reference

#include <mongocxx/v_noabi/mongocxx/gridfs/uploader.hpp>

Description

Class used to upload a GridFS file.

Public Member Functions

 uploader () noexcept
 Default constructs an uploader object. The uploader is equivalent to the state of a moved from uploader. The only valid actions to take with a default constructed uploader are to assign to it, or destroy it.
 
 uploader (uploader &&) noexcept
 Move constructs an uploader.
 
 ~uploader ()
 Destroys an uploader.
 
void abort ()
 Aborts uploading the file.
 
std::int32_t chunk_size () const
 Gets the chunk size of the file being uploaded.
 
result::gridfs::upload close ()
 Closes the uploader stream.
 
 operator bool () const noexcept
 Returns true if the uploader is valid, meaning it was not default constructed or moved from.
 
uploaderoperator= (uploader &&) noexcept
 Move assigns an uploader.
 
void write (const std::uint8_t *bytes, std::size_t length)
 Writes a specified number of bytes to a GridFS file.
 

Constructor & Destructor Documentation

◆ uploader() [1/2]

mongocxx::v_noabi::gridfs::uploader::uploader ( )
noexcept

Default constructs an uploader object. The uploader is equivalent to the state of a moved from uploader. The only valid actions to take with a default constructed uploader are to assign to it, or destroy it.

◆ uploader() [2/2]

mongocxx::v_noabi::gridfs::uploader::uploader ( uploader && )
noexcept

Move constructs an uploader.

◆ ~uploader()

mongocxx::v_noabi::gridfs::uploader::~uploader ( )

Destroys an uploader.

Member Function Documentation

◆ abort()

void mongocxx::v_noabi::gridfs::uploader::abort ( )

Aborts uploading the file.

Exceptions
mongocxx::v_noabi::logic_errorif the upload stream was already closed.
mongocxx::v_noabi::bulk_write_exceptionif an error occurs when removing chunk data from the database.

◆ chunk_size()

std::int32_t mongocxx::v_noabi::gridfs::uploader::chunk_size ( ) const

Gets the chunk size of the file being uploaded.

Returns
The chunk size in bytes.

◆ close()

result::gridfs::upload mongocxx::v_noabi::gridfs::uploader::close ( )

Closes the uploader stream.

Exceptions
mongocxx::v_noabi::logic_errorif the upload stream was already closed.
mongocxx::v_noabi::bulk_write_exceptionif an error occurs when writing chunk data or file metadata to the database.
mongocxx::v_noabi::gridfs_exceptionif the uploader requires more than 2^31-1 chunks to store the file at the requested chunk size.

◆ operator bool()

mongocxx::v_noabi::gridfs::uploader::operator bool ( ) const
explicitnoexcept

Returns true if the uploader is valid, meaning it was not default constructed or moved from.

◆ operator=()

uploader & mongocxx::v_noabi::gridfs::uploader::operator= ( uploader && )
noexcept

Move assigns an uploader.

◆ write()

void mongocxx::v_noabi::gridfs::uploader::write ( const std::uint8_t * bytes,
std::size_t length )

Writes a specified number of bytes to a GridFS file.

Parameters
bytesA pointer to the bytes to write.
lengthThe number of bytes to write.
Exceptions
mongocxx::v_noabi::logic_errorif the upload stream was already closed.
mongocxx::v_noabi::bulk_write_exceptionif an error occurs when writing chunk data to the database.
mongocxx::v_noabi::gridfs_exceptionif the uploader requires more than 2^31-1 chunks to store the file at the requested chunk size.

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