MongoDB C++ Driver 4.1.4
Loading...
Searching...
No Matches
bsoncxx::v_noabi::types::bson_value::value Class Reference

#include <bsoncxx/v_noabi/bsoncxx/types/bson_value/value.hpp>

Description

An owning variant type that represents any BSON type.

Owns its underlying buffer. When a bson_value::value goes out of scope, its underlying buffer is freed.

For accessors into this type and to extract the various BSON types out, please use bson_value::view.

See also

Public Member Functions

 value (bool v)
 Constructs a BSON boolean value.
 value (bson_value::view const &)
 Create an owning copy of a bson_value::view.
 value (bsoncxx::v_noabi::array::view v)
 Constructs a BSON array value.
 value (bsoncxx::v_noabi::document::view v)
 Constructs a BSON document value.
 value (char const *v)
 Constructs a BSON UTF-8 string value.
 value (decimal128 v)
 Constructs a BSON Decimal128 value.
 value (double v)
 Constructs a BSON double value.
 value (int32_t v)
 Constructs a BSON 32-bit signed integer value.
 value (int64_t v)
 Constructs a BSON 64-bit signed integer value.
 value (oid v)
 Constructs a BSON ObjectId value.
 value (std::chrono::milliseconds v)
 Constructs a BSON date value.
 value (std::nullptr_t)
 Constructs a BSON null value.
 value (std::string v)
 Constructs a BSON UTF-8 string value.
 value (std::vector< unsigned char > v, binary_sub_type const sub_type={})
 Constructs a BSON binary data value.
 value (stdx::string_view code, bsoncxx::v_noabi::document::view_or_value scope)
 Constructs a BSON JavaScript code with scope value.
 value (stdx::string_view collection, oid value)
 Constructs a BSON DBPointer value.
 value (stdx::string_view regex, stdx::string_view options)
 Constructs a BSON regex value with options.
 value (stdx::string_view v)
 Constructs a BSON UTF-8 string value.
 value (type const id)
 Constructs one of the following BSON values (each specified by the parenthesized type):
 value (type const id, stdx::string_view v)
 Constructs one of the following BSON values (each specified by the parenthesized type):
 value (type const id, uint64_t a, uint64_t b)
 Constructs one of the following BSON values (each specified by the parenthesized type):
 value (uint8_t const *data, size_t size, binary_sub_type const sub_type={})
 Constructs a BSON binary data value.
 operator bson_value::view () const noexcept
 Conversion operator that provides a bson_value::view given a bson_value::value.
bson_value::view view () const noexcept
 Get a view over the bson_value owned by this object.
 value (b_double v)
 Construct a bson_value::value from the provided BSON type.
 value (b_string v)
 Construct a bson_value::value from the provided BSON type.
 value (b_document v)
 Construct a bson_value::value from the provided BSON type.
 value (b_array v)
 Construct a bson_value::value from the provided BSON type.
 value (b_binary v)
 Construct a bson_value::value from the provided BSON type.
 value (b_undefined v)
 Construct a bson_value::value from the provided BSON type.
 value (b_oid v)
 Construct a bson_value::value from the provided BSON type.
 value (b_bool v)
 Construct a bson_value::value from the provided BSON type.
 value (b_date v)
 Construct a bson_value::value from the provided BSON type.
 value (b_null)
 Construct a bson_value::value from the provided BSON type.
 value (b_regex v)
 Construct a bson_value::value from the provided BSON type.
 value (b_dbpointer v)
 Construct a bson_value::value from the provided BSON type.
 value (b_code v)
 Construct a bson_value::value from the provided BSON type.
 value (b_symbol v)
 Construct a bson_value::value from the provided BSON type.
 value (b_codewscope v)
 Construct a bson_value::value from the provided BSON type.
 value (b_int32 v)
 Construct a bson_value::value from the provided BSON type.
 value (b_timestamp v)
 Construct a bson_value::value from the provided BSON type.
 value (b_int64 v)
 Construct a bson_value::value from the provided BSON type.
 value (b_decimal128 v)
 Construct a bson_value::value from the provided BSON type.
 value (b_maxkey v)
 Construct a bson_value::value from the provided BSON type.
 value (b_minkey v)
 Construct a bson_value::value from the provided BSON type.

(Note that these are not member symbols.)

bool operator== (value const &lhs, value const &rhs)
 Compares values for (in)-equality.
bool operator!= (value const &lhs, value const &rhs)
 Compares values for (in)-equality.
bool operator== (value const &lhs, view const &rhs)
 Compares a value with a view for (in)equality.
bool operator== (view const &lhs, value const &rhs)
 Compares a value with a view for (in)equality.
bool operator!= (value const &lhs, view const &rhs)
 Compares a value with a view for (in)equality.
bool operator!= (view const &lhs, value const &rhs)
 Compares a value with a view for (in)equality.

Constructor & Destructor Documentation

◆ value() [1/43]

bsoncxx::v_noabi::types::bson_value::value::value ( b_double v)

Construct a bson_value::value from the provided BSON type.

◆ value() [2/43]

bsoncxx::v_noabi::types::bson_value::value::value ( b_string v)

Construct a bson_value::value from the provided BSON type.

◆ value() [3/43]

bsoncxx::v_noabi::types::bson_value::value::value ( b_document v)

Construct a bson_value::value from the provided BSON type.

◆ value() [4/43]

bsoncxx::v_noabi::types::bson_value::value::value ( b_array v)

Construct a bson_value::value from the provided BSON type.

◆ value() [5/43]

bsoncxx::v_noabi::types::bson_value::value::value ( b_binary v)

Construct a bson_value::value from the provided BSON type.

◆ value() [6/43]

bsoncxx::v_noabi::types::bson_value::value::value ( b_undefined v)

Construct a bson_value::value from the provided BSON type.

◆ value() [7/43]

bsoncxx::v_noabi::types::bson_value::value::value ( b_oid v)

Construct a bson_value::value from the provided BSON type.

◆ value() [8/43]

bsoncxx::v_noabi::types::bson_value::value::value ( b_bool v)

Construct a bson_value::value from the provided BSON type.

◆ value() [9/43]

bsoncxx::v_noabi::types::bson_value::value::value ( b_date v)

Construct a bson_value::value from the provided BSON type.

◆ value() [10/43]

bsoncxx::v_noabi::types::bson_value::value::value ( b_null )

Construct a bson_value::value from the provided BSON type.

◆ value() [11/43]

bsoncxx::v_noabi::types::bson_value::value::value ( b_regex v)

Construct a bson_value::value from the provided BSON type.

◆ value() [12/43]

bsoncxx::v_noabi::types::bson_value::value::value ( b_dbpointer v)

Construct a bson_value::value from the provided BSON type.

◆ value() [13/43]

bsoncxx::v_noabi::types::bson_value::value::value ( b_code v)

Construct a bson_value::value from the provided BSON type.

◆ value() [14/43]

bsoncxx::v_noabi::types::bson_value::value::value ( b_symbol v)

Construct a bson_value::value from the provided BSON type.

◆ value() [15/43]

bsoncxx::v_noabi::types::bson_value::value::value ( b_codewscope v)

Construct a bson_value::value from the provided BSON type.

◆ value() [16/43]

bsoncxx::v_noabi::types::bson_value::value::value ( b_int32 v)

Construct a bson_value::value from the provided BSON type.

◆ value() [17/43]

bsoncxx::v_noabi::types::bson_value::value::value ( b_timestamp v)

Construct a bson_value::value from the provided BSON type.

◆ value() [18/43]

bsoncxx::v_noabi::types::bson_value::value::value ( b_int64 v)

Construct a bson_value::value from the provided BSON type.

◆ value() [19/43]

bsoncxx::v_noabi::types::bson_value::value::value ( b_decimal128 v)

Construct a bson_value::value from the provided BSON type.

◆ value() [20/43]

bsoncxx::v_noabi::types::bson_value::value::value ( b_maxkey v)

Construct a bson_value::value from the provided BSON type.

◆ value() [21/43]

bsoncxx::v_noabi::types::bson_value::value::value ( b_minkey v)

Construct a bson_value::value from the provided BSON type.

◆ value() [22/43]

bsoncxx::v_noabi::types::bson_value::value::value ( char const * v)

Constructs a BSON UTF-8 string value.

◆ value() [23/43]

bsoncxx::v_noabi::types::bson_value::value::value ( std::string v)

Constructs a BSON UTF-8 string value.

◆ value() [24/43]

bsoncxx::v_noabi::types::bson_value::value::value ( stdx::string_view v)

Constructs a BSON UTF-8 string value.

◆ value() [25/43]

bsoncxx::v_noabi::types::bson_value::value::value ( int32_t v)

Constructs a BSON 32-bit signed integer value.

◆ value() [26/43]

bsoncxx::v_noabi::types::bson_value::value::value ( int64_t v)

Constructs a BSON 64-bit signed integer value.

◆ value() [27/43]

bsoncxx::v_noabi::types::bson_value::value::value ( double v)

Constructs a BSON double value.

◆ value() [28/43]

bsoncxx::v_noabi::types::bson_value::value::value ( bool v)

Constructs a BSON boolean value.

◆ value() [29/43]

bsoncxx::v_noabi::types::bson_value::value::value ( oid v)

Constructs a BSON ObjectId value.

◆ value() [30/43]

bsoncxx::v_noabi::types::bson_value::value::value ( decimal128 v)

Constructs a BSON Decimal128 value.

◆ value() [31/43]

bsoncxx::v_noabi::types::bson_value::value::value ( std::chrono::milliseconds v)

Constructs a BSON date value.

◆ value() [32/43]

bsoncxx::v_noabi::types::bson_value::value::value ( std::nullptr_t )

Constructs a BSON null value.

◆ value() [33/43]

bsoncxx::v_noabi::types::bson_value::value::value ( bsoncxx::v_noabi::document::view v)

Constructs a BSON document value.

◆ value() [34/43]

bsoncxx::v_noabi::types::bson_value::value::value ( bsoncxx::v_noabi::array::view v)

Constructs a BSON array value.

◆ value() [35/43]

bsoncxx::v_noabi::types::bson_value::value::value ( std::vector< unsigned char > v,
binary_sub_type const sub_type = {} )

Constructs a BSON binary data value.

Parameters
va stream of bytes
sub_typean optional binary sub type. Defaults to type::k_binary

◆ value() [36/43]

bsoncxx::v_noabi::types::bson_value::value::value ( uint8_t const * data,
size_t size,
binary_sub_type const sub_type = {} )

Constructs a BSON binary data value.

Parameters
datapointer to a stream of bytes
sizethe size of the stream of bytes
sub_typean optional binary sub type. Defaults to type::k_binary

◆ value() [37/43]

bsoncxx::v_noabi::types::bson_value::value::value ( stdx::string_view collection,
oid value )

Constructs a BSON DBPointer value.

Parameters
collectionthe collection name
valuethe object id
Warning
The DBPointer (aka DBRef) BSON type is deprecated. Usage is discouraged.

◆ value() [38/43]

bsoncxx::v_noabi::types::bson_value::value::value ( stdx::string_view code,
bsoncxx::v_noabi::document::view_or_value scope )

Constructs a BSON JavaScript code with scope value.

Parameters
codethe JavaScript code
scopea bson document view holding the scope environment

◆ value() [39/43]

bsoncxx::v_noabi::types::bson_value::value::value ( stdx::string_view regex,
stdx::string_view options )

Constructs a BSON regex value with options.

Parameters
regexThe regex pattern
optionsThe regex options

◆ value() [40/43]

bsoncxx::v_noabi::types::bson_value::value::value ( type const id,
stdx::string_view v )

Constructs one of the following BSON values (each specified by the parenthesized type):

Parameters
idthe type of BSON value to construct.
vthe symbol, JavaScript code, or regex pattern for the BSON symbol, code, or regex value respectively.
Exceptions
bsoncxx::v_noabi::exceptionif the type's value is not k_code, k_regex, or k_symbol.
Warning
The Symbol BSON type is deprecated. Usage is discouraged.
The Undefined BSON type is deprecated. Usage is discouraged.

◆ value() [41/43]

bsoncxx::v_noabi::types::bson_value::value::value ( type const id)

Constructs one of the following BSON values (each specified by the parenthesized type):

Parameters
idthe type of BSON value to construct.
Exceptions
bsoncxx::v_noabi::exceptionif the type's value is not k_maxkey, k_minkey, or k_undefined.

◆ value() [42/43]

bsoncxx::v_noabi::types::bson_value::value::value ( type const id,
uint64_t a,
uint64_t b )

Constructs one of the following BSON values (each specified by the parenthesized type):

Parameters
idthe type of the BSON value to construct.
aIf a BSON decimal128 value is to be constructed, this is the high value. If a BSON timestamp value is to be constructed, this is the increment.
bIf a BSON decimal128 value is to be constructed, this is the low value. If a BSON timestamp value is to be constructed, this is the timestamp.
Exceptions
bsoncxx::v_noabi::exceptionif the specified type is missing its required arguments.
Warning
The BSON timestamp type is used internally by the MongoDB server - use by clients is discouraged.

◆ value() [43/43]

bsoncxx::v_noabi::types::bson_value::value::value ( bson_value::view const & )
explicit

Create an owning copy of a bson_value::view.

Member Function Documentation

◆ operator bson_value::view()

bsoncxx::v_noabi::types::bson_value::value::operator bson_value::view ( ) const
noexcept

Conversion operator that provides a bson_value::view given a bson_value::value.

◆ view()

bson_value::view bsoncxx::v_noabi::types::bson_value::value::view ( ) const
noexcept

Get a view over the bson_value owned by this object.

◆ operator!=() [1/3]

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

Compares values for (in)-equality.

◆ operator!=() [2/3]

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

Compares a value with a view for (in)equality.

◆ operator!=() [3/3]

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

Compares a value with a view for (in)equality.

◆ operator==() [1/3]

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

Compares values for (in)-equality.

◆ operator==() [2/3]

bool operator== ( value const & lhs,
view const & rhs )
related

Compares a value with a view for (in)equality.

◆ operator==() [3/3]

bool operator== ( view const & lhs,
value const & rhs )
related

Compares a value with a view for (in)equality.


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