Loading...
Searching...
No Matches
bsoncxx::v_noabi::builder::basic::sub_binary Class Reference

`#include <bsoncxx/v_noabi/bsoncxx/builder/basic/sub_binary.hpp>`

## Description

Represents a BSON Binary element being constructed during an append operation.

## Public Member Functions

| sub_binary (core *core)
| Default constructor.
std::uint8_t * | allocate (binary_sub_type sub_type, std::uint32_t length)
| Allocate space for an un-initialized BSON Binary element of any subtype.
template<typename Format, typename SFINAE = typename vector::detail::format_traits<Format>::value_type>
vector::accessor< Format > | allocate (Format fmt, std::size_t element_count)
| Allocate and format space for a BSON Binary Vector with uninitialized elements.

## Constructor & Destructor Documentation

## sub_binary()

bsoncxx::v_noabi::builder::basic::sub_binary::sub_binary | ( | core * | core | ) |

inline

Default constructor.

## Member Function Documentation

## allocate() [1/2]

std::uint8_t * bsoncxx::v_noabi::builder::basic::sub_binary::allocate | ( | binary_sub_type | sub_type,
|  | std::uint32_t | length )

inline

Allocate space for an un-initialized BSON Binary element of any subtype.

Parameters

  sub_type | BSON binary subtype code, identifying the format of the data within.
  length | Number of bytes to allocate

Returns
  Pointer to uninitialized memory within the bson_t, valid only during this sub_binary builder's lifetime. The caller must overwrite every byte if the resulting BSON document is to be used.

Exceptions

  bsoncxx::v_noabi::exception | if this sub_binary has already allocated.
  bsoncxx::v_noabi::exception | if the binary fails to append due to the BSON size limit.

## allocate() [2/2]

template<typename Format, typename SFINAE = typename vector::detail::format_traits<Format>::value_type>

vector::accessor< Format > bsoncxx::v_noabi::builder::basic::sub_binary::allocate | ( | Format | fmt,
|  | std::size_t | element_count )

inline

Allocate and format space for a BSON Binary Vector with uninitialized elements.

Parameters

  fmt | Instance of a format type from bsoncxx::v_noabi::vector::formats
  element_count | Number of elements to allocate space for.

Returns
  A writable vector::accessor, valid during the lifetime of this sub_binary builder. Every element must be overwritten before that element is read or the resulting document is used.

Exceptions

  bsoncxx::v_noabi::exception | if this sub_binary has already allocated.
  bsoncxx::v_noabi::exception | if the binary fails to append due to the BSON size limit.
  bsoncxx::v_noabi::exception | if a vector of the requested size would be too large to represent.

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

- bsoncxx/v_noabi/bsoncxx/builder/basic/sub_binary.hpp