MongoDB C++ Driver 4.3.0
Loading...
Searching...
No Matches
bsoncxx::v1::types::value Class Reference

#include <bsoncxx/v1/types/value.hpp>

Description

A union of BSON type values.

Attention
This feature is experimental! It is not ready for use!
Note
A "BSON type value" refers to the value of a BSON element without its key.

Public Types

enum class  errc
 Errors codes which may be returned by bsoncxx::v1::types::value. More...

Public Member Functions

 value ()
 Initialize with bsoncxx::v1::types::b_null.
 value (bool v)
 Initialize as a bsoncxx::v1::types::b_bool.
 value (char const *v)
 Initialize as a bsoncxx::v1::types::b_string.
 value (double v)
 Initialize as a bsoncxx::v1::types::b_double.
 value (std::chrono::milliseconds v)
 Initialize as a bsoncxx::v1::types::b_date.
 value (std::int32_t v)
 Initialize as a bsoncxx::v1::types::b_int32.
 value (std::int64_t v)
 Initialize as a bsoncxx::v1::types::b_int64.
 value (std::nullptr_t)
 Initialize as a bsoncxx::v1::types::b_null.
 value (std::string const &v)
 Initialize as a bsoncxx::v1::types::b_string.
 value (std::uint8_t const *data, std::size_t size)
 Initialize as a bsoncxx::v1::types::b_binary with bsoncxx::v1::types::binary_subtype::k_binary.
 value (std::uint8_t const *data, std::size_t size, v1::types::binary_subtype const sub_type)
 Initialize as a bsoncxx::v1::types::b_binary with subtype.
 value (std::vector< std::uint8_t > const &v)
 Initialize as a bsoncxx::v1::types::b_binary with bsoncxx::v1::types::binary_subtype::k_binary.
 value (std::vector< std::uint8_t > const &v, v1::types::binary_subtype subtype)
 Initialize with v as a bsoncxx::v1::types::b_binary with subtype.
 value (v1::array::view v)
 Initialize as a bsoncxx::v1::types::b_array.
 value (v1::decimal128 v)
 Initialize as a bsoncxx::v1::types::b_decimal128.
 value (v1::document::view v)
 Initialize as a bsoncxx::v1::types::b_document.
 value (v1::oid v)
 Initialize as a bsoncxx::v1::types::b_oid.
 value (v1::stdx::string_view c, v1::oid v)
 Initialize as a bsoncxx::v1::types::b_dbpointer.
 value (v1::stdx::string_view code, v1::document::view scope)
 Initialize as a bsoncxx::v1::types::b_codewscope.
 value (v1::stdx::string_view regex, v1::stdx::string_view options)
 Initialize as a bsoncxx::v1::types::b_regex.
 value (v1::stdx::string_view v)
 Initialize as a bsoncxx::v1::types::b_string.
 value (v1::types::view const &v)
 Initialize with a deep copy of the underlying BSON type value.
 value (value &&other) noexcept
 Move construction.
 value (value const &other)
 Copy construction.
 ~value ()
 Destroy this object.
 operator v1::types::view () const
 Implicitly convert to this->view().
valueoperator= (value &&other) noexcept
 Move assignment.
valueoperator= (value const &other)
 Copy assignment.
v1::types::id type_id () const
 Return the type of the underlying BSON type value.
v1::types::view view () const
 Return a view of the underlying BSON type value.
 value (v1::types::b_minkey v)
 Convert v as a deep copy.
 value (v1::types::b_double v)
 Convert v as a deep copy.
 value (v1::types::b_string v)
 Convert v as a deep copy.
 value (v1::types::b_document v)
 Convert v as a deep copy.
 value (v1::types::b_array v)
 Convert v as a deep copy.
 value (v1::types::b_binary v)
 Convert v as a deep copy.
 value (v1::types::b_undefined v)
 Convert v as a deep copy.
 value (v1::types::b_oid v)
 Convert v as a deep copy.
 value (v1::types::b_bool v)
 Convert v as a deep copy.
 value (v1::types::b_date v)
 Convert v as a deep copy.
 value (v1::types::b_null v)
 Convert v as a deep copy.
 value (v1::types::b_regex v)
 Convert v as a deep copy.
 value (v1::types::b_dbpointer v)
 Convert v as a deep copy.
 value (v1::types::b_code v)
 Convert v as a deep copy.
 value (v1::types::b_symbol v)
 Convert v as a deep copy.
 value (v1::types::b_codewscope v)
 Convert v as a deep copy.
 value (v1::types::b_int32 v)
 Convert v as a deep copy.
 value (v1::types::b_timestamp v)
 Convert v as a deep copy.
 value (v1::types::b_int64 v)
 Convert v as a deep copy.
 value (v1::types::b_decimal128 v)
 Convert v as a deep copy.
 value (v1::types::b_maxkey v)
 Convert v as a deep copy.
v1::types::b_minkey get_minkey () const
 Equivalent to this->view().get_type() where get_type is the correct name for the requested BSON type value (e.g. this->view().get_double() given this->get_double()).
v1::types::b_double get_double () const
 Equivalent to this->view().get_type() where get_type is the correct name for the requested BSON type value (e.g. this->view().get_double() given this->get_double()).
v1::types::b_string get_string () const
 Equivalent to this->view().get_type() where get_type is the correct name for the requested BSON type value (e.g. this->view().get_double() given this->get_double()).
v1::types::b_document get_document () const
 Equivalent to this->view().get_type() where get_type is the correct name for the requested BSON type value (e.g. this->view().get_double() given this->get_double()).
v1::types::b_array get_array () const
 Equivalent to this->view().get_type() where get_type is the correct name for the requested BSON type value (e.g. this->view().get_double() given this->get_double()).
v1::types::b_binary get_binary () const
 Equivalent to this->view().get_type() where get_type is the correct name for the requested BSON type value (e.g. this->view().get_double() given this->get_double()).
v1::types::b_undefined get_undefined () const
 Equivalent to this->view().get_type() where get_type is the correct name for the requested BSON type value (e.g. this->view().get_double() given this->get_double()).
v1::types::b_oid get_oid () const
 Equivalent to this->view().get_type() where get_type is the correct name for the requested BSON type value (e.g. this->view().get_double() given this->get_double()).
v1::types::b_bool get_bool () const
 Equivalent to this->view().get_type() where get_type is the correct name for the requested BSON type value (e.g. this->view().get_double() given this->get_double()).
v1::types::b_date get_date () const
 Equivalent to this->view().get_type() where get_type is the correct name for the requested BSON type value (e.g. this->view().get_double() given this->get_double()).
v1::types::b_null get_null () const
 Equivalent to this->view().get_type() where get_type is the correct name for the requested BSON type value (e.g. this->view().get_double() given this->get_double()).
v1::types::b_regex get_regex () const
 Equivalent to this->view().get_type() where get_type is the correct name for the requested BSON type value (e.g. this->view().get_double() given this->get_double()).
v1::types::b_dbpointer get_dbpointer () const
 Equivalent to this->view().get_type() where get_type is the correct name for the requested BSON type value (e.g. this->view().get_double() given this->get_double()).
v1::types::b_code get_code () const
 Equivalent to this->view().get_type() where get_type is the correct name for the requested BSON type value (e.g. this->view().get_double() given this->get_double()).
v1::types::b_symbol get_symbol () const
 Equivalent to this->view().get_type() where get_type is the correct name for the requested BSON type value (e.g. this->view().get_double() given this->get_double()).
v1::types::b_codewscope get_codewscope () const
 Equivalent to this->view().get_type() where get_type is the correct name for the requested BSON type value (e.g. this->view().get_double() given this->get_double()).
v1::types::b_int32 get_int32 () const
 Equivalent to this->view().get_type() where get_type is the correct name for the requested BSON type value (e.g. this->view().get_double() given this->get_double()).
v1::types::b_timestamp get_timestamp () const
 Equivalent to this->view().get_type() where get_type is the correct name for the requested BSON type value (e.g. this->view().get_double() given this->get_double()).
v1::types::b_int64 get_int64 () const
 Equivalent to this->view().get_type() where get_type is the correct name for the requested BSON type value (e.g. this->view().get_double() given this->get_double()).
v1::types::b_decimal128 get_decimal128 () const
 Equivalent to this->view().get_type() where get_type is the correct name for the requested BSON type value (e.g. this->view().get_double() given this->get_double()).
v1::types::b_maxkey get_maxkey () const
 Equivalent to this->view().get_type() where get_type is the correct name for the requested BSON type value (e.g. this->view().get_double() given this->get_double()).

Static Public Member Functions

static std::error_category const & error_category ()
 The error category for bsoncxx::v1::types::value::errc.

Friends

std::error_code make_error_code (errc v)
 Support implicit conversion to std::error_code.
bool operator!= (value const &lhs, value const &rhs)
 Equivalent to !(lhs == rhs).
bool operator== (value const &lhs, value const &rhs)
 Equivalent to lhs.view() == rhs.view().

Member Enumeration Documentation

◆ errc

Errors codes which may be returned by bsoncxx::v1::types::value.

Attention
This feature is experimental! It is not ready for use!
Enumerator
zero 

Zero.

invalid_type 

Requested BSON type is not supported.

invalid_length_u32 

Length is too long (exceeds UINT32_MAX).

Constructor & Destructor Documentation

◆ ~value()

bsoncxx::v1::types::value::~value ( )

Destroy this object.

◆ value() [1/45]

bsoncxx::v1::types::value::value ( value && other)
noexcept

Move construction.

Postconditions:
  • other is equivalent to a default-initialized value.

◆ value() [2/45]

bsoncxx::v1::types::value::value ( value const & other)

Copy construction.

The copied BSON type value is allocated (when necessary) using bson_value_copy.

◆ value() [3/45]

bsoncxx::v1::types::value::value ( )
inline

Initialize with bsoncxx::v1::types::b_null.

◆ value() [4/45]

bsoncxx::v1::types::value::value ( v1::types::view const & v)
explicit

Initialize with a deep copy of the underlying BSON type value.

The copied value is allocated (when necessary) using bson_malloc.

Exceptions
bsoncxx::v1::exceptionwith bsoncxx::v1::types::value::errc::invalid_type if `v.type_id()` is not a supported value (not defined by BSONCXX_V1_TYPES_XMACRO).
bsoncxx::v1::exceptionwith bsoncxx::v1::types::value::errc::invalid_length_u32 if the length of any underlying BSON type value component is not representable as an std::uint32_t.

◆ value() [5/45]

bsoncxx::v1::types::value::value ( v1::types::b_minkey v)
explicit

Convert v as a deep copy.

The copied value is allocated (when necessary) using bson_malloc.

Exceptions
bsoncxx::v1::exceptionwith bsoncxx::v1::types::value::errc::invalid_length_u32 if the length of any underlying BSON type value component is not representable as an std::uint32_t as required by the corresponding bsoncxx::v1::types::b_<type>.

◆ value() [6/45]

bsoncxx::v1::types::value::value ( v1::types::b_double v)
explicit

Convert v as a deep copy.

The copied value is allocated (when necessary) using bson_malloc.

Exceptions
bsoncxx::v1::exceptionwith bsoncxx::v1::types::value::errc::invalid_length_u32 if the length of any underlying BSON type value component is not representable as an std::uint32_t as required by the corresponding bsoncxx::v1::types::b_<type>.

◆ value() [7/45]

bsoncxx::v1::types::value::value ( v1::types::b_string v)
explicit

Convert v as a deep copy.

The copied value is allocated (when necessary) using bson_malloc.

Exceptions
bsoncxx::v1::exceptionwith bsoncxx::v1::types::value::errc::invalid_length_u32 if the length of any underlying BSON type value component is not representable as an std::uint32_t as required by the corresponding bsoncxx::v1::types::b_<type>.

◆ value() [8/45]

bsoncxx::v1::types::value::value ( v1::types::b_document v)
explicit

Convert v as a deep copy.

The copied value is allocated (when necessary) using bson_malloc.

Exceptions
bsoncxx::v1::exceptionwith bsoncxx::v1::types::value::errc::invalid_length_u32 if the length of any underlying BSON type value component is not representable as an std::uint32_t as required by the corresponding bsoncxx::v1::types::b_<type>.

◆ value() [9/45]

bsoncxx::v1::types::value::value ( v1::types::b_array v)
explicit

Convert v as a deep copy.

The copied value is allocated (when necessary) using bson_malloc.

Exceptions
bsoncxx::v1::exceptionwith bsoncxx::v1::types::value::errc::invalid_length_u32 if the length of any underlying BSON type value component is not representable as an std::uint32_t as required by the corresponding bsoncxx::v1::types::b_<type>.

◆ value() [10/45]

bsoncxx::v1::types::value::value ( v1::types::b_binary v)
explicit

Convert v as a deep copy.

The copied value is allocated (when necessary) using bson_malloc.

Exceptions
bsoncxx::v1::exceptionwith bsoncxx::v1::types::value::errc::invalid_length_u32 if the length of any underlying BSON type value component is not representable as an std::uint32_t as required by the corresponding bsoncxx::v1::types::b_<type>.

◆ value() [11/45]

bsoncxx::v1::types::value::value ( v1::types::b_undefined v)
explicit

Convert v as a deep copy.

The copied value is allocated (when necessary) using bson_malloc.

Exceptions
bsoncxx::v1::exceptionwith bsoncxx::v1::types::value::errc::invalid_length_u32 if the length of any underlying BSON type value component is not representable as an std::uint32_t as required by the corresponding bsoncxx::v1::types::b_<type>.

◆ value() [12/45]

bsoncxx::v1::types::value::value ( v1::types::b_oid v)
explicit

Convert v as a deep copy.

The copied value is allocated (when necessary) using bson_malloc.

Exceptions
bsoncxx::v1::exceptionwith bsoncxx::v1::types::value::errc::invalid_length_u32 if the length of any underlying BSON type value component is not representable as an std::uint32_t as required by the corresponding bsoncxx::v1::types::b_<type>.

◆ value() [13/45]

bsoncxx::v1::types::value::value ( v1::types::b_bool v)
explicit

Convert v as a deep copy.

The copied value is allocated (when necessary) using bson_malloc.

Exceptions
bsoncxx::v1::exceptionwith bsoncxx::v1::types::value::errc::invalid_length_u32 if the length of any underlying BSON type value component is not representable as an std::uint32_t as required by the corresponding bsoncxx::v1::types::b_<type>.

◆ value() [14/45]

bsoncxx::v1::types::value::value ( v1::types::b_date v)
explicit

Convert v as a deep copy.

The copied value is allocated (when necessary) using bson_malloc.

Exceptions
bsoncxx::v1::exceptionwith bsoncxx::v1::types::value::errc::invalid_length_u32 if the length of any underlying BSON type value component is not representable as an std::uint32_t as required by the corresponding bsoncxx::v1::types::b_<type>.

◆ value() [15/45]

bsoncxx::v1::types::value::value ( v1::types::b_null v)
explicit

Convert v as a deep copy.

The copied value is allocated (when necessary) using bson_malloc.

Exceptions
bsoncxx::v1::exceptionwith bsoncxx::v1::types::value::errc::invalid_length_u32 if the length of any underlying BSON type value component is not representable as an std::uint32_t as required by the corresponding bsoncxx::v1::types::b_<type>.

◆ value() [16/45]

bsoncxx::v1::types::value::value ( v1::types::b_regex v)
explicit

Convert v as a deep copy.

The copied value is allocated (when necessary) using bson_malloc.

Exceptions
bsoncxx::v1::exceptionwith bsoncxx::v1::types::value::errc::invalid_length_u32 if the length of any underlying BSON type value component is not representable as an std::uint32_t as required by the corresponding bsoncxx::v1::types::b_<type>.

◆ value() [17/45]

bsoncxx::v1::types::value::value ( v1::types::b_dbpointer v)
explicit

Convert v as a deep copy.

The copied value is allocated (when necessary) using bson_malloc.

Exceptions
bsoncxx::v1::exceptionwith bsoncxx::v1::types::value::errc::invalid_length_u32 if the length of any underlying BSON type value component is not representable as an std::uint32_t as required by the corresponding bsoncxx::v1::types::b_<type>.

◆ value() [18/45]

bsoncxx::v1::types::value::value ( v1::types::b_code v)
explicit

Convert v as a deep copy.

The copied value is allocated (when necessary) using bson_malloc.

Exceptions
bsoncxx::v1::exceptionwith bsoncxx::v1::types::value::errc::invalid_length_u32 if the length of any underlying BSON type value component is not representable as an std::uint32_t as required by the corresponding bsoncxx::v1::types::b_<type>.

◆ value() [19/45]

bsoncxx::v1::types::value::value ( v1::types::b_symbol v)
explicit

Convert v as a deep copy.

The copied value is allocated (when necessary) using bson_malloc.

Exceptions
bsoncxx::v1::exceptionwith bsoncxx::v1::types::value::errc::invalid_length_u32 if the length of any underlying BSON type value component is not representable as an std::uint32_t as required by the corresponding bsoncxx::v1::types::b_<type>.

◆ value() [20/45]

bsoncxx::v1::types::value::value ( v1::types::b_codewscope v)
explicit

Convert v as a deep copy.

The copied value is allocated (when necessary) using bson_malloc.

Exceptions
bsoncxx::v1::exceptionwith bsoncxx::v1::types::value::errc::invalid_length_u32 if the length of any underlying BSON type value component is not representable as an std::uint32_t as required by the corresponding bsoncxx::v1::types::b_<type>.

◆ value() [21/45]

bsoncxx::v1::types::value::value ( v1::types::b_int32 v)
explicit

Convert v as a deep copy.

The copied value is allocated (when necessary) using bson_malloc.

Exceptions
bsoncxx::v1::exceptionwith bsoncxx::v1::types::value::errc::invalid_length_u32 if the length of any underlying BSON type value component is not representable as an std::uint32_t as required by the corresponding bsoncxx::v1::types::b_<type>.

◆ value() [22/45]

bsoncxx::v1::types::value::value ( v1::types::b_timestamp v)
explicit

Convert v as a deep copy.

The copied value is allocated (when necessary) using bson_malloc.

Exceptions
bsoncxx::v1::exceptionwith bsoncxx::v1::types::value::errc::invalid_length_u32 if the length of any underlying BSON type value component is not representable as an std::uint32_t as required by the corresponding bsoncxx::v1::types::b_<type>.

◆ value() [23/45]

bsoncxx::v1::types::value::value ( v1::types::b_int64 v)
explicit

Convert v as a deep copy.

The copied value is allocated (when necessary) using bson_malloc.

Exceptions
bsoncxx::v1::exceptionwith bsoncxx::v1::types::value::errc::invalid_length_u32 if the length of any underlying BSON type value component is not representable as an std::uint32_t as required by the corresponding bsoncxx::v1::types::b_<type>.

◆ value() [24/45]

bsoncxx::v1::types::value::value ( v1::types::b_decimal128 v)
explicit

Convert v as a deep copy.

The copied value is allocated (when necessary) using bson_malloc.

Exceptions
bsoncxx::v1::exceptionwith bsoncxx::v1::types::value::errc::invalid_length_u32 if the length of any underlying BSON type value component is not representable as an std::uint32_t as required by the corresponding bsoncxx::v1::types::b_<type>.

◆ value() [25/45]

bsoncxx::v1::types::value::value ( v1::types::b_maxkey v)
explicit

Convert v as a deep copy.

The copied value is allocated (when necessary) using bson_malloc.

Exceptions
bsoncxx::v1::exceptionwith bsoncxx::v1::types::value::errc::invalid_length_u32 if the length of any underlying BSON type value component is not representable as an std::uint32_t as required by the corresponding bsoncxx::v1::types::b_<type>.

◆ value() [26/45]

bsoncxx::v1::types::value::value ( std::nullptr_t )
inlineexplicit

Initialize as a bsoncxx::v1::types::b_null.

◆ value() [27/45]

bsoncxx::v1::types::value::value ( v1::stdx::string_view v)
inlineexplicit

Initialize as a bsoncxx::v1::types::b_string.

◆ value() [28/45]

bsoncxx::v1::types::value::value ( std::int32_t v)
inlineexplicit

Initialize as a bsoncxx::v1::types::b_int32.

◆ value() [29/45]

bsoncxx::v1::types::value::value ( std::int64_t v)
inlineexplicit

Initialize as a bsoncxx::v1::types::b_int64.

◆ value() [30/45]

bsoncxx::v1::types::value::value ( double v)
inlineexplicit

Initialize as a bsoncxx::v1::types::b_double.

◆ value() [31/45]

bsoncxx::v1::types::value::value ( bool v)
inlineexplicit

Initialize as a bsoncxx::v1::types::b_bool.

◆ value() [32/45]

bsoncxx::v1::types::value::value ( v1::oid v)
inlineexplicit

Initialize as a bsoncxx::v1::types::b_oid.

◆ value() [33/45]

bsoncxx::v1::types::value::value ( v1::decimal128 v)
inlineexplicit

◆ value() [34/45]

bsoncxx::v1::types::value::value ( std::chrono::milliseconds v)
inlineexplicit

Initialize as a bsoncxx::v1::types::b_date.

◆ value() [35/45]

bsoncxx::v1::types::value::value ( v1::document::view v)
inlineexplicit

◆ value() [36/45]

bsoncxx::v1::types::value::value ( v1::array::view v)
inlineexplicit

Initialize as a bsoncxx::v1::types::b_array.

◆ value() [37/45]

bsoncxx::v1::types::value::value ( std::vector< std::uint8_t > const & v)
inlineexplicit

◆ value() [38/45]

bsoncxx::v1::types::value::value ( std::vector< std::uint8_t > const & v,
v1::types::binary_subtype subtype )
inlineexplicit

Initialize with v as a bsoncxx::v1::types::b_binary with subtype.

◆ value() [39/45]

bsoncxx::v1::types::value::value ( v1::stdx::string_view c,
v1::oid v )
inlineexplicit

◆ value() [40/45]

bsoncxx::v1::types::value::value ( v1::stdx::string_view code,
v1::document::view scope )
inlineexplicit

◆ value() [41/45]

bsoncxx::v1::types::value::value ( v1::stdx::string_view regex,
v1::stdx::string_view options )
inlineexplicit

Initialize as a bsoncxx::v1::types::b_regex.

◆ value() [42/45]

bsoncxx::v1::types::value::value ( char const * v)
inlineexplicit

Initialize as a bsoncxx::v1::types::b_string.

◆ value() [43/45]

bsoncxx::v1::types::value::value ( std::string const & v)
inlineexplicit

Initialize as a bsoncxx::v1::types::b_string.

◆ value() [44/45]

bsoncxx::v1::types::value::value ( std::uint8_t const * data,
std::size_t size )
inlineexplicit

◆ value() [45/45]

bsoncxx::v1::types::value::value ( std::uint8_t const * data,
std::size_t size,
v1::types::binary_subtype const sub_type )
explicit

Initialize as a bsoncxx::v1::types::b_binary with subtype.

Member Function Documentation

◆ error_category()

std::error_category const & bsoncxx::v1::types::value::error_category ( )
static

The error category for bsoncxx::v1::types::value::errc.

Attention
This feature is experimental! It is not ready for use!

◆ get_array()

v1::types::b_array bsoncxx::v1::types::value::get_array ( ) const
inline

Equivalent to this->view().get_type() where get_type is the correct name for the requested BSON type value (e.g. this->view().get_double() given this->get_double()).

Exceptions
bsoncxx::v1::exceptionwith bsoncxx::v1::types::view::errc::type_mismatch if the underlying BSON type value does not match the requested type.

◆ get_binary()

v1::types::b_binary bsoncxx::v1::types::value::get_binary ( ) const
inline

Equivalent to this->view().get_type() where get_type is the correct name for the requested BSON type value (e.g. this->view().get_double() given this->get_double()).

Exceptions
bsoncxx::v1::exceptionwith bsoncxx::v1::types::view::errc::type_mismatch if the underlying BSON type value does not match the requested type.

◆ get_bool()

v1::types::b_bool bsoncxx::v1::types::value::get_bool ( ) const
inline

Equivalent to this->view().get_type() where get_type is the correct name for the requested BSON type value (e.g. this->view().get_double() given this->get_double()).

Exceptions
bsoncxx::v1::exceptionwith bsoncxx::v1::types::view::errc::type_mismatch if the underlying BSON type value does not match the requested type.

◆ get_code()

v1::types::b_code bsoncxx::v1::types::value::get_code ( ) const
inline

Equivalent to this->view().get_type() where get_type is the correct name for the requested BSON type value (e.g. this->view().get_double() given this->get_double()).

Exceptions
bsoncxx::v1::exceptionwith bsoncxx::v1::types::view::errc::type_mismatch if the underlying BSON type value does not match the requested type.

◆ get_codewscope()

v1::types::b_codewscope bsoncxx::v1::types::value::get_codewscope ( ) const
inline

Equivalent to this->view().get_type() where get_type is the correct name for the requested BSON type value (e.g. this->view().get_double() given this->get_double()).

Exceptions
bsoncxx::v1::exceptionwith bsoncxx::v1::types::view::errc::type_mismatch if the underlying BSON type value does not match the requested type.

◆ get_date()

v1::types::b_date bsoncxx::v1::types::value::get_date ( ) const
inline

Equivalent to this->view().get_type() where get_type is the correct name for the requested BSON type value (e.g. this->view().get_double() given this->get_double()).

Exceptions
bsoncxx::v1::exceptionwith bsoncxx::v1::types::view::errc::type_mismatch if the underlying BSON type value does not match the requested type.

◆ get_dbpointer()

v1::types::b_dbpointer bsoncxx::v1::types::value::get_dbpointer ( ) const
inline

Equivalent to this->view().get_type() where get_type is the correct name for the requested BSON type value (e.g. this->view().get_double() given this->get_double()).

Exceptions
bsoncxx::v1::exceptionwith bsoncxx::v1::types::view::errc::type_mismatch if the underlying BSON type value does not match the requested type.

◆ get_decimal128()

v1::types::b_decimal128 bsoncxx::v1::types::value::get_decimal128 ( ) const
inline

Equivalent to this->view().get_type() where get_type is the correct name for the requested BSON type value (e.g. this->view().get_double() given this->get_double()).

Exceptions
bsoncxx::v1::exceptionwith bsoncxx::v1::types::view::errc::type_mismatch if the underlying BSON type value does not match the requested type.

◆ get_document()

v1::types::b_document bsoncxx::v1::types::value::get_document ( ) const
inline

Equivalent to this->view().get_type() where get_type is the correct name for the requested BSON type value (e.g. this->view().get_double() given this->get_double()).

Exceptions
bsoncxx::v1::exceptionwith bsoncxx::v1::types::view::errc::type_mismatch if the underlying BSON type value does not match the requested type.

◆ get_double()

v1::types::b_double bsoncxx::v1::types::value::get_double ( ) const
inline

Equivalent to this->view().get_type() where get_type is the correct name for the requested BSON type value (e.g. this->view().get_double() given this->get_double()).

Exceptions
bsoncxx::v1::exceptionwith bsoncxx::v1::types::view::errc::type_mismatch if the underlying BSON type value does not match the requested type.

◆ get_int32()

v1::types::b_int32 bsoncxx::v1::types::value::get_int32 ( ) const
inline

Equivalent to this->view().get_type() where get_type is the correct name for the requested BSON type value (e.g. this->view().get_double() given this->get_double()).

Exceptions
bsoncxx::v1::exceptionwith bsoncxx::v1::types::view::errc::type_mismatch if the underlying BSON type value does not match the requested type.

◆ get_int64()

v1::types::b_int64 bsoncxx::v1::types::value::get_int64 ( ) const
inline

Equivalent to this->view().get_type() where get_type is the correct name for the requested BSON type value (e.g. this->view().get_double() given this->get_double()).

Exceptions
bsoncxx::v1::exceptionwith bsoncxx::v1::types::view::errc::type_mismatch if the underlying BSON type value does not match the requested type.

◆ get_maxkey()

v1::types::b_maxkey bsoncxx::v1::types::value::get_maxkey ( ) const
inline

Equivalent to this->view().get_type() where get_type is the correct name for the requested BSON type value (e.g. this->view().get_double() given this->get_double()).

Exceptions
bsoncxx::v1::exceptionwith bsoncxx::v1::types::view::errc::type_mismatch if the underlying BSON type value does not match the requested type.

◆ get_minkey()

v1::types::b_minkey bsoncxx::v1::types::value::get_minkey ( ) const
inline

Equivalent to this->view().get_type() where get_type is the correct name for the requested BSON type value (e.g. this->view().get_double() given this->get_double()).

Exceptions
bsoncxx::v1::exceptionwith bsoncxx::v1::types::view::errc::type_mismatch if the underlying BSON type value does not match the requested type.

◆ get_null()

v1::types::b_null bsoncxx::v1::types::value::get_null ( ) const
inline

Equivalent to this->view().get_type() where get_type is the correct name for the requested BSON type value (e.g. this->view().get_double() given this->get_double()).

Exceptions
bsoncxx::v1::exceptionwith bsoncxx::v1::types::view::errc::type_mismatch if the underlying BSON type value does not match the requested type.

◆ get_oid()

v1::types::b_oid bsoncxx::v1::types::value::get_oid ( ) const
inline

Equivalent to this->view().get_type() where get_type is the correct name for the requested BSON type value (e.g. this->view().get_double() given this->get_double()).

Exceptions
bsoncxx::v1::exceptionwith bsoncxx::v1::types::view::errc::type_mismatch if the underlying BSON type value does not match the requested type.

◆ get_regex()

v1::types::b_regex bsoncxx::v1::types::value::get_regex ( ) const
inline

Equivalent to this->view().get_type() where get_type is the correct name for the requested BSON type value (e.g. this->view().get_double() given this->get_double()).

Exceptions
bsoncxx::v1::exceptionwith bsoncxx::v1::types::view::errc::type_mismatch if the underlying BSON type value does not match the requested type.

◆ get_string()

v1::types::b_string bsoncxx::v1::types::value::get_string ( ) const
inline

Equivalent to this->view().get_type() where get_type is the correct name for the requested BSON type value (e.g. this->view().get_double() given this->get_double()).

Exceptions
bsoncxx::v1::exceptionwith bsoncxx::v1::types::view::errc::type_mismatch if the underlying BSON type value does not match the requested type.

◆ get_symbol()

v1::types::b_symbol bsoncxx::v1::types::value::get_symbol ( ) const
inline

Equivalent to this->view().get_type() where get_type is the correct name for the requested BSON type value (e.g. this->view().get_double() given this->get_double()).

Exceptions
bsoncxx::v1::exceptionwith bsoncxx::v1::types::view::errc::type_mismatch if the underlying BSON type value does not match the requested type.

◆ get_timestamp()

v1::types::b_timestamp bsoncxx::v1::types::value::get_timestamp ( ) const
inline

Equivalent to this->view().get_type() where get_type is the correct name for the requested BSON type value (e.g. this->view().get_double() given this->get_double()).

Exceptions
bsoncxx::v1::exceptionwith bsoncxx::v1::types::view::errc::type_mismatch if the underlying BSON type value does not match the requested type.

◆ get_undefined()

v1::types::b_undefined bsoncxx::v1::types::value::get_undefined ( ) const
inline

Equivalent to this->view().get_type() where get_type is the correct name for the requested BSON type value (e.g. this->view().get_double() given this->get_double()).

Exceptions
bsoncxx::v1::exceptionwith bsoncxx::v1::types::view::errc::type_mismatch if the underlying BSON type value does not match the requested type.

◆ operator v1::types::view()

bsoncxx::v1::types::value::operator v1::types::view ( ) const
inline

Implicitly convert to this->view().

◆ operator=() [1/2]

value & bsoncxx::v1::types::value::operator= ( value && other)
noexcept

Move assignment.

Postconditions:
  • other is equivalent to a default-initialized value.

◆ operator=() [2/2]

value & bsoncxx::v1::types::value::operator= ( value const & other)

Copy assignment.

The copied value is allocated (when necessary) using bson_value_copy.

◆ type_id()

v1::types::id bsoncxx::v1::types::value::type_id ( ) const

Return the type of the underlying BSON type value.

◆ view()

v1::types::view bsoncxx::v1::types::value::view ( ) const

Return a view of the underlying BSON type value.

◆ make_error_code

std::error_code make_error_code ( errc v)
friend

Support implicit conversion to std::error_code.

Attention
This feature is experimental! It is not ready for use!

◆ operator!=

bool operator!= ( value const & lhs,
value const & rhs )
friend

Equivalent to !(lhs == rhs).

◆ operator==

bool operator== ( value const & lhs,
value const & rhs )
friend

Equivalent to lhs.view() == rhs.view().


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