MongoDB C++ Driver  mongocxx-3.4.0
Public Member Functions | List of all members
bsoncxx::types::value Class Reference

A variant that can contain any BSON type. More...

#include <value.hpp>

Public Member Functions

 value (b_double) noexcept
 Construct a value from a BSON double.
 
 value (b_utf8) noexcept
 Construct a value from a BSON UTF-8 string.
 
 value (b_document) noexcept
 Construct a value from a BSON document.
 
 value (b_array) noexcept
 Construct a value from a BSON array.
 
 value (b_binary) noexcept
 Construct a value from a BSON binary datum.
 
 value (b_undefined) noexcept
 Construct a value from a BSON undefined.
 
 value (b_oid) noexcept
 Construct a value from a BSON ObjectId.
 
 value (b_bool) noexcept
 Construct a value from a BSON boolean.
 
 value (b_date) noexcept
 Construct a value from a BSON date.
 
 value (b_null) noexcept
 Construct a value from a BSON null.
 
 value (b_regex) noexcept
 Construct a value from a BSON regex.
 
 value (b_dbpointer) noexcept
 Construct a value from a BSON DBPointer.
 
 value (b_code) noexcept
 Construct a value from a BSON JavaScript code.
 
 value (b_symbol) noexcept
 Construct a value from a BSON symbol.
 
 value (b_codewscope) noexcept
 Construct a value from a BSON JavaScript code with scope.
 
 value (b_int32) noexcept
 Construct a value from a BSON 32-bit signed integer.
 
 value (b_timestamp) noexcept
 Construct a value from a BSON replication timestamp.
 
 value (b_int64) noexcept
 Construct a value from a BSON 64-bit signed integer.
 
 value (b_decimal128) noexcept
 Construct a value from a BSON Decimal128.
 
 value (b_minkey) noexcept
 Construct a value from a BSON min-key.
 
 value (b_maxkey) noexcept
 Construct a value from a BSON max-key.
 
bsoncxx::type type () const
 
const b_doubleget_double () const
 
const b_utf8get_utf8 () const
 
const b_documentget_document () const
 
const b_arrayget_array () const
 
const b_binaryget_binary () const
 
const b_undefinedget_undefined () const
 
const b_oidget_oid () const
 
const b_boolget_bool () const
 
const b_dateget_date () const
 
const b_nullget_null () const
 
const b_regexget_regex () const
 
const b_dbpointerget_dbpointer () const
 
const b_codeget_code () const
 
const b_symbolget_symbol () const
 
const b_codewscopeget_codewscope () const
 
const b_int32get_int32 () const
 
const b_timestampget_timestamp () const
 
const b_int64get_int64 () const
 
const b_decimal128get_decimal128 () const
 
const b_minkeyget_minkey () const
 
const b_maxkeyget_maxkey () const
 
bool operator== (const value &, const value &)
 Compare two values for equality.
 
bool operator!= (const value &, const value &)
 Compare two values for equality.
 

Detailed Description

A variant that can contain any BSON type.

Warning
It is undefined behavior to call the wrong get_<type> method. Check the underlying type() first.

Member Function Documentation

◆ get_array()

const b_array& bsoncxx::types::value::get_array ( ) const
Returns
The underlying BSON array value.
Warning
It is undefined behavior to call the wrong get_<type> method. Check the underlying type() first.

◆ get_binary()

const b_binary& bsoncxx::types::value::get_binary ( ) const
Returns
The underlying BSON binary data value.
Warning
It is undefined behavior to call the wrong get_<type> method. Check the underlying type() first.

◆ get_bool()

const b_bool& bsoncxx::types::value::get_bool ( ) const
Returns
The underlying BSON boolean value.
Warning
It is undefined behavior to call the wrong get_<type> method. Check the underlying type() first.

◆ get_code()

const b_code& bsoncxx::types::value::get_code ( ) const
Returns
The underlying BSON JavaScript code value.
Warning
It is undefined behavior to call the wrong get_<type> method. Check the underlying type() first.

◆ get_codewscope()

const b_codewscope& bsoncxx::types::value::get_codewscope ( ) const
Returns
The underlying BSON JavaScript code with scope value.
Warning
It is undefined behavior to call the wrong get_<type> method. Check the underlying type() first.

◆ get_date()

const b_date& bsoncxx::types::value::get_date ( ) const
Returns
The underlying BSON date value.
Warning
It is undefined behavior to call the wrong get_<type> method. Check the underlying type() first.

◆ get_dbpointer()

const b_dbpointer& bsoncxx::types::value::get_dbpointer ( ) const
Returns
The underlying BSON DBPointer value.
Warning
It is undefined behavior to call the wrong get_<type> method. Check the underlying type() first.

◆ get_decimal128()

const b_decimal128& bsoncxx::types::value::get_decimal128 ( ) const
Returns
The underlying BSON Decimal128 value.
Warning
It is undefined behavior to call the wrong get_<type> method. Check the underlying type() first.

◆ get_document()

const b_document& bsoncxx::types::value::get_document ( ) const
Returns
The underlying BSON document value.
Warning
It is undefined behavior to call the wrong get_<type> method. Check the underlying type() first.

◆ get_double()

const b_double& bsoncxx::types::value::get_double ( ) const
Returns
The underlying BSON double value.
Warning
It is undefined behavior to call the wrong get_<type> method. Check the underlying type() first.

◆ get_int32()

const b_int32& bsoncxx::types::value::get_int32 ( ) const
Returns
The underlying BSON 32-bit signed integer value.
Warning
It is undefined behavior to call the wrong get_<type> method. Check the underlying type() first.

◆ get_int64()

const b_int64& bsoncxx::types::value::get_int64 ( ) const
Returns
The underlying BSON 64-bit signed integer value.
Warning
It is undefined behavior to call the wrong get_<type> method. Check the underlying type() first.

◆ get_maxkey()

const b_maxkey& bsoncxx::types::value::get_maxkey ( ) const
Returns
The underlying BSON max-key value.
Warning
It is undefined behavior to call the wrong get_<type> method. Check the underlying type() first.

◆ get_minkey()

const b_minkey& bsoncxx::types::value::get_minkey ( ) const
Returns
The underlying BSON min-key value.
Warning
It is undefined behavior to call the wrong get_<type> method. Check the underlying type() first.

◆ get_null()

const b_null& bsoncxx::types::value::get_null ( ) const
Returns
The underlying BSON null value.
Warning
It is undefined behavior to call the wrong get_<type> method. Check the underlying type() first.

◆ get_oid()

const b_oid& bsoncxx::types::value::get_oid ( ) const
Returns
The underlying BSON ObjectId value.
Warning
It is undefined behavior to call the wrong get_<type> method. Check the underlying type() first.

◆ get_regex()

const b_regex& bsoncxx::types::value::get_regex ( ) const
Returns
The underlying BSON regex value.
Warning
It is undefined behavior to call the wrong get_<type> method. Check the underlying type() first.

◆ get_symbol()

const b_symbol& bsoncxx::types::value::get_symbol ( ) const
Returns
The underlying BSON symbol value.
Warning
It is undefined behavior to call the wrong get_<type> method. Check the underlying type() first.

◆ get_timestamp()

const b_timestamp& bsoncxx::types::value::get_timestamp ( ) const
Returns
The underlying BSON replication timestamp value.
Warning
It is undefined behavior to call the wrong get_<type> method. Check the underlying type() first.

◆ get_undefined()

const b_undefined& bsoncxx::types::value::get_undefined ( ) const
Returns
The underlying BSON undefined value.
Warning
It is undefined behavior to call the wrong get_<type> method. Check the underlying type() first.

◆ get_utf8()

const b_utf8& bsoncxx::types::value::get_utf8 ( ) const
Returns
The underlying BSON UTF-8 string value.
Warning
It is undefined behavior to call the wrong get_<type> method. Check the underlying type() first.

◆ type()

bsoncxx::type bsoncxx::types::value::type ( ) const
Returns
The type of the underlying BSON value stored in this object.

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