Loading...
Searching...
No Matches
mongocxx::gridfs::uploader Class Reference

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

## Description

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=default
| Move constructs an uploader.
| uploader (v1::gridfs::uploader uploader)
| Construct with the mongocxx::v1 equivalent.
| ~uploader ()=default
| 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.
| operator v1::gridfs::uploader () &&
| Convert to the mongocxx::v1 equivalent.
| operator v1::gridfs::uploader () const &=delete
| This class is not copyable.
uploader & | operator= (uploader &&) noexcept=default
| Move assigns an uploader.
void | write (std::uint8_t const *bytes, std::size_t length)
| Writes a specified number of bytes to a GridFS file.

## Constructor & Destructor Documentation

## uploader() [1/3]

mongocxx::v_noabi::gridfs::uploader::uploader | ( |  | ) |

inline 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/3]

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

default noexcept

Move constructs an uploader.

## uploader() [3/3]

mongocxx::v_noabi::gridfs::uploader::uploader | ( | v1::gridfs::uploader | uploader | ) |

inline

Construct with the mongocxx::v1 equivalent.

## ~uploader()

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

default

Destroys an uploader.

## Member Function Documentation

## abort()

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

Aborts uploading the file.

Exceptions

  mongocxx::v_noabi::logic_error | if the upload stream was already closed.
  mongocxx::v_noabi::bulk_write_exception | if 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_error | if the upload stream was already closed.
  mongocxx::v_noabi::bulk_write_exception | if an error occurs when writing chunk data or file metadata to the database.
  mongocxx::v_noabi::gridfs_exception | if 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

inline explicit noexcept

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

## operator v1::gridfs::uploader() [1/2]

mongocxx::v_noabi::gridfs::uploader::operator v1::gridfs::uploader | ( |  | ) | &&

inline explicit

Convert to the mongocxx::v1 equivalent.

Postconditions:
  - *this is in an assign-or-destroy-only state.

Warning
  Invalidates all associated objects.

## operator v1::gridfs::uploader() [2/2]

mongocxx::v_noabi::gridfs::uploader::operator v1::gridfs::uploader | ( |  | ) | const &

explicit delete

This class is not copyable.

## operator=()

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

default noexcept

Move assigns an uploader.

## write()

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

Writes a specified number of bytes to a GridFS file.

Parameters

  bytes | A pointer to the bytes to write.
  length | The number of bytes to write.

Exceptions

  mongocxx::v_noabi::logic_error | if the upload stream was already closed.
  mongocxx::v_noabi::bulk_write_exception | if an error occurs when writing chunk data to the database.
  mongocxx::v_noabi::gridfs_exception | if 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:

- mongocxx/v_noabi/mongocxx/gridfs/uploader.hpp