47enum class type : std::uint8_t {
96 return static_cast<type>(v);
157 operator double()
const {
168 BSONCXX_PRIVATE_WARNINGS_PUSH();
169 BSONCXX_PRIVATE_WARNINGS_DISABLE(GNU(
"-Wfloat-equal"));
170 return lhs.value == rhs.value;
171 BSONCXX_PRIVATE_WARNINGS_POP();
186 template <
typename T, detail::requires_not_t<
int, detail::is_alike<b_
string, T>> = 0>
187 explicit b_string(T&& t) : value(std::forward<T>(t)) {}
205 return lhs.value == rhs.value;
237 return lhs.value == rhs.value;
262 return lhs.value == rhs.value;
273 uint8_t
const* bytes;
282 return lhs.sub_type == rhs.sub_type && lhs.size == rhs.size &&
283 (!lhs.size || (std::memcmp(lhs.bytes, rhs.bytes, lhs.size) == 0));
319 return lhs.value == rhs.value;
333 operator bool()
const {
344 return lhs.value == rhs.value;
359 explicit b_date(std::chrono::milliseconds value) : value(value) {}
367 explicit b_date(std::chrono::system_clock::time_point
const& tp)
368 : value(std::chrono::duration_cast<std::chrono::milliseconds>(tp.time_since_epoch())) {}
370 std::chrono::milliseconds
value;
375 operator int64_t()
const {
376 return value.count();
383 return value.count();
389 operator std::chrono::system_clock::time_point()
const {
390 return std::chrono::system_clock::time_point(
391 std::chrono::duration_cast<std::chrono::system_clock::duration>(
value));
401 return lhs.value == rhs.value;
435 template <
typename T,
typename U = stdx::
string_view, detail::requires_not_t<
int, detail::is_alike<b_regex, T>> = 0>
436 explicit b_regex(T&& regex, U&& options = U{}) : regex(std::forward<T>(regex)), options(std::forward<U>(options)) {}
448 return lhs.regex == rhs.regex && lhs.options == rhs.options;
469 return lhs.collection == rhs.collection && lhs.value == rhs.value;
484 template <
typename T, detail::requires_not_t<
int, detail::is_alike<b_code, T>> = 0>
485 explicit b_code(T&& t) : code(std::forward<T>(t)) {}
503 return lhs.code == rhs.code;
520 template <
typename T, detail::requires_not_t<
int, detail::is_alike<b_symbol, T>> = 0>
521 explicit b_symbol(T&& t) : symbol(std::forward<T>(t)) {}
539 return lhs.symbol == rhs.symbol;
557 template <
typename T,
typename U, detail::requires_not_t<
int, detail::is_alike<b_codewscope, T>> = 0>
558 explicit b_codewscope(T&& code, U&& scope) : code(std::forward<T>(code)), scope(std::forward<U>(scope)) {}
570 return lhs.code == rhs.code && lhs.scope == rhs.scope;
584 operator int32_t()
const {
595 return lhs.value == rhs.value;
614 return lhs.increment == rhs.increment && lhs.timestamp == rhs.timestamp;
628 operator int64_t()
const {
639 return lhs.value == rhs.value;
656 template <
typename T, detail::requires_not_t<
int, detail::is_alike<b_decimal128, T>> = 0>
666 return lhs.value == rhs.value;
707 return !(lhs == rhs);
716 return !(lhs == rhs);
725 return !(lhs == rhs);
734 return !(lhs == rhs);
743 return !(lhs == rhs);
752 return !(lhs == rhs);
761 return !(lhs == rhs);
770 return !(lhs == rhs);
779 return !(lhs == rhs);
788 return !(lhs == rhs);
797 return !(lhs == rhs);
806 return !(lhs == rhs);
815 return !(lhs == rhs);
824 return !(lhs == rhs);
833 return !(lhs == rhs);
842 return !(lhs == rhs);
851 return !(lhs == rhs);
860 return !(lhs == rhs);
869 return !(lhs == rhs);
878 return !(lhs == rhs);
887 return !(lhs == rhs);
890#pragma push_macro("X")
892#define X(_name, _val) BSONCXX_PRIVATE_INLINE_CXX17 constexpr type b_##_name::type_id;
894#pragma pop_macro("X")
1106using v_noabi::types::operator==;
1107using v_noabi::types::operator!=;
The bsoncxx v_noabi macro guard postlude header.
The bsoncxx v_noabi macro guard prelude header.
A polyfill for std::string_view.
Definition string_view.hpp:412
A read-only, non-owning view of a BSON document.
Definition view.hpp:41
Represents a MongoDB BSON Decimal128.
Definition decimal128.hpp:45
A read-only, non-owning view of a BSON document.
Definition view.hpp:40
Represents a MongoDB BSON ObjectId.
Definition oid.hpp:41
Declares entities representing BSON value types.
std::string to_string(id rhs)
Return the name of the enumerator (e.g. "double" given k_double).
binary_subtype
Enumeration identifying a BSON binary subtype.
Definition id.hpp:77
id
Enumeration identifying a BSON type.
Definition id.hpp:39
bson_value::value value
Equivalent to bsoncxx::v_noabi::types::bson_value::value.
Definition value-fwd.hpp:35
Declares entities whose ABI stability is NOT guaranteed.
binary_sub_type
An enumeration of each BSON binary sub type.
Definition types.hpp:78
@ k_uuid
UUID.
Definition types.hpp:83
@ k_binary_deprecated
Binary (Old).
Definition types.hpp:81
@ k_sensitive
Sensitive.
Definition types.hpp:87
@ k_md5
MD5.
Definition types.hpp:84
@ k_user
User defined.
Definition types.hpp:89
@ k_function
Function.
Definition types.hpp:80
@ k_column
Compressed BSON column.
Definition types.hpp:86
@ k_uuid_deprecated
UUID (Old).
Definition types.hpp:82
@ k_encrypted
Encrypted BSON value.
Definition types.hpp:85
@ k_vector
BSON Binary Vector.
Definition types.hpp:88
std::string to_string(type rhs)
Returns a stringification of the given type.
Definition types.hpp:128
type
An enumeration of each BSON type.
Definition types.hpp:47
@ k_decimal128
128-bit decimal floating point.
Definition types.hpp:66
@ k_minkey
Min key.
Definition types.hpp:68
@ k_double
64-bit binary floating point.
Definition types.hpp:48
@ k_dbpointer
DBPointer.
Definition types.hpp:59
@ k_int64
64-bit integer.
Definition types.hpp:65
@ k_codewscope
JavaScript code with scope.
Definition types.hpp:62
@ k_regex
Regular expression.
Definition types.hpp:58
@ k_string
UTF-8 string.
Definition types.hpp:49
@ k_array
Array.
Definition types.hpp:51
@ k_bool
Boolean.
Definition types.hpp:55
@ k_symbol
Symbol.
Definition types.hpp:61
@ k_oid
ObjectId.
Definition types.hpp:54
@ k_date
UTC datetime.
Definition types.hpp:56
@ k_int32
32-bit integer.
Definition types.hpp:63
@ k_timestamp
Timestamp.
Definition types.hpp:64
@ k_undefined
Undefined value.
Definition types.hpp:53
@ k_code
JavaScript code.
Definition types.hpp:60
@ k_document
Embedded document.
Definition types.hpp:50
@ k_maxkey
Max key.
Definition types.hpp:67
@ k_binary
Binary data.
Definition types.hpp:52
@ k_null
Null value.
Definition types.hpp:57
v1::element::view to_v1(v_noabi::array::element const &v)
Convert to the bsoncxx::v1 equivalent of v.
Definition element.hpp:132
v_noabi::array::value from_v1(v1::array::value const &v)
Convert from the bsoncxx::v1 equivalent of v.
Definition value.hpp:267
The top-level namespace within which all bsoncxx library entities are declared.
b_code(T &&t)
Constructor for b_code.
Definition types.hpp:485
b_codewscope(T &&code, U &&scope)
Constructor for b_codewscope.
Definition types.hpp:558
b_date(std::chrono::milliseconds value)
Constructor for b_date.
Definition types.hpp:359
b_decimal128(T &&t)
Constructor for b_decimal128.
Definition types.hpp:657
b_regex(T &®ex, U &&options=U{})
Constructor for b_regex.
Definition types.hpp:436
b_string(T &&t)
Constructor for b_string.
Definition types.hpp:187
b_symbol(T &&t)
Constructor for b_symbol.
Definition types.hpp:521
BSON type value "Array".
Definition view.hpp:201
v1::array::view value
The represented value.
Definition view.hpp:210
BSON type value "Binary Data".
Definition view.hpp:249
binary_subtype subtype
The represented value's binary subtype component.
Definition view.hpp:258
std::uint8_t const * bytes
The represented value's binary data.
Definition view.hpp:268
std::uint32_t size
The represented value's length of binary data.
Definition view.hpp:263
BSON type value "Boolean".
Definition view.hpp:392
bool value
The represented value.
Definition view.hpp:401
BSON type value "JavaScript Code".
Definition view.hpp:624
v1::stdx::string_view code
The represented value.
Definition view.hpp:633
BSON type value "JavaScript Code With Scope".
Definition view.hpp:724
v1::document::view scope
The represented value's "$scope" component.
Definition view.hpp:738
v1::stdx::string_view code
The represented value's "$code" component.
Definition view.hpp:733
BSON type value "UTC Datetime".
Definition view.hpp:440
std::chrono::milliseconds value
The represented value (milliseconds relative to the Unix epoch).
Definition view.hpp:449
BSON type value "DBPointer".
Definition view.hpp:578
v1::oid value
The represented value's "$id" (ObjectID) component.
Definition view.hpp:592
v1::stdx::string_view collection
The represented value's "$ref" (namespace) component.
Definition view.hpp:587
BSON type value "Decimal128".
Definition view.hpp:912
v1::decimal128 value
The represented value.
Definition view.hpp:921
BSON type value "Embedded Document".
Definition view.hpp:149
v1::document::view value
The represented value.
Definition view.hpp:158
BSON type value "64-bit Binary Floating Point".
Definition view.hpp:50
double value
The represented value.
Definition view.hpp:59
BSON type value "32-bit Integer".
Definition view.hpp:770
std::int32_t value
The represented value.
Definition view.hpp:779
BSON type value "64-bit Integer".
Definition view.hpp:864
std::int64_t value
The represented value.
Definition view.hpp:873
BSON type value "Max Key".
Definition view.hpp:960
BSON type value "Min Key".
Definition view.hpp:986
BSON type value "Null Value".
Definition view.hpp:499
BSON type value "ObjectID".
Definition view.hpp:344
v1::oid value
The represented value.
Definition view.hpp:353
BSON type value "Regular Expression".
Definition view.hpp:525
v1::stdx::string_view regex
The represented value's "pattern" component.
Definition view.hpp:534
v1::stdx::string_view options
The represented value's "options" component.
Definition view.hpp:539
BSON type value "UTF-8 String".
Definition view.hpp:101
v1::stdx::string_view value
The represented value.
Definition view.hpp:110
BSON type value "Symbol".
Definition view.hpp:674
v1::stdx::string_view symbol
The represented value.
Definition view.hpp:683
BSON type value "Timestamp".
Definition view.hpp:818
std::uint32_t increment
The represented value's "i" component.
Definition view.hpp:827
std::uint32_t timestamp
The represented value's "t" component.
Definition view.hpp:832
BSON type value "Undefined (Value)".
Definition view.hpp:318
A BSON array value.
Definition types.hpp:243
bool operator==(b_array const &lhs, b_array const &rhs)
free function comparator for b_array
Definition types.hpp:261
bool operator!=(b_array const &lhs, b_array const &rhs)
free function comparator for b_array
Definition types.hpp:733
A BSON binary data value.
Definition types.hpp:268
bool operator==(b_binary const &lhs, b_binary const &rhs)
free function comparator for b_binary
Definition types.hpp:281
bool operator!=(b_binary const &lhs, b_binary const &rhs)
free function comparator for b_binary
Definition types.hpp:742
A BSON boolean value.
Definition types.hpp:325
bool operator!=(b_bool const &lhs, b_bool const &rhs)
free function comparator for b_bool
Definition types.hpp:769
bool operator==(b_bool const &lhs, b_bool const &rhs)
free function comparator for b_bool
Definition types.hpp:343
A BSON JavaScript code value.
Definition types.hpp:475
bool operator!=(b_code const &lhs, b_code const &rhs)
free function comparator for b_code
Definition types.hpp:814
bool operator==(b_code const &lhs, b_code const &rhs)
free function comparator for b_code
Definition types.hpp:502
b_code(T &&t)
Constructor for b_code.
Definition types.hpp:485
A BSON JavaScript code with scope value.
Definition types.hpp:545
bool operator==(b_codewscope const &lhs, b_codewscope const &rhs)
free function comparator for b_codewscope
Definition types.hpp:569
bool operator!=(b_codewscope const &lhs, b_codewscope const &rhs)
free function comparator for b_codewscope
Definition types.hpp:832
b_codewscope(T &&code, U &&scope)
Constructor for b_codewscope.
Definition types.hpp:558
A BSON date value.
Definition types.hpp:350
bool operator==(b_date const &lhs, b_date const &rhs)
free function comparator for b_date
Definition types.hpp:400
bool operator!=(b_date const &lhs, b_date const &rhs)
free function comparator for b_date
Definition types.hpp:778
int64_t to_int64() const
Manually convert this b_date to an int64_t.
Definition types.hpp:382
b_date(std::chrono::system_clock::time_point const &tp)
Constructor for b_date.
Definition types.hpp:367
b_date(std::chrono::milliseconds value)
Constructor for b_date.
Definition types.hpp:359
A BSON DBPointer (aka DBRef) value.
Definition types.hpp:456
bool operator==(b_dbpointer const &lhs, b_dbpointer const &rhs)
free function comparator for b_dbpointer
Definition types.hpp:468
bool operator!=(b_dbpointer const &lhs, b_dbpointer const &rhs)
free function comparator for b_dbpointer
Definition types.hpp:805
A BSON Decimal128 value.
Definition types.hpp:645
bool operator!=(b_decimal128 const &lhs, b_decimal128 const &rhs)
free function comparator for b_decimal128
Definition types.hpp:868
bool operator==(b_decimal128 const &lhs, b_decimal128 const &rhs)
free function comparator for b_decimal128
Definition types.hpp:665
b_decimal128(T &&t)
Constructor for b_decimal128.
Definition types.hpp:657
A BSON document value.
Definition types.hpp:211
bool operator==(b_document const &lhs, b_document const &rhs)
free function comparator for b_document
Definition types.hpp:236
document::view view()
Returns an unwrapped document::view.
Definition types.hpp:226
bool operator!=(b_document const &lhs, b_document const &rhs)
free function comparator for b_document
Definition types.hpp:724
A BSON double value.
Definition types.hpp:149
bool operator!=(b_double const &lhs, b_double const &rhs)
free function comparator for b_double
Definition types.hpp:706
bool operator==(b_double const &lhs, b_double const &rhs)
free function comparator for b_double
Definition types.hpp:167
A BSON signed 32-bit integer value.
Definition types.hpp:576
bool operator==(b_int32 const &lhs, b_int32 const &rhs)
free function comparator for b_int32
Definition types.hpp:594
bool operator!=(b_int32 const &lhs, b_int32 const &rhs)
free function comparator for b_int32
Definition types.hpp:841
A BSON 64-bit signed integer value.
Definition types.hpp:620
bool operator!=(b_int64 const &lhs, b_int64 const &rhs)
free function comparator for b_int64
Definition types.hpp:859
bool operator==(b_int64 const &lhs, b_int64 const &rhs)
free function comparator for b_int64
Definition types.hpp:638
A BSON max-key value.
Definition types.hpp:688
bool operator!=(b_maxkey const &lhs, b_maxkey const &rhs)
free function comparator for b_maxkey
Definition types.hpp:886
bool operator==(b_maxkey const &, b_maxkey const &)
free function comparator for b_maxkey
Definition types.hpp:697
A BSON min-key value.
Definition types.hpp:672
bool operator==(b_minkey const &, b_minkey const &)
free function comparator for b_minkey
Definition types.hpp:681
bool operator!=(b_minkey const &lhs, b_minkey const &rhs)
free function comparator for b_minkey
Definition types.hpp:877
A BSON null value.
Definition types.hpp:407
bool operator==(b_null const &, b_null const &)
free function comparator for b_null
Definition types.hpp:416
bool operator!=(b_null const &lhs, b_null const &rhs)
free function comparator for b_null
Definition types.hpp:787
A BSON ObjectId value.
Definition types.hpp:307
bool operator==(b_oid const &lhs, b_oid const &rhs)
free function comparator for b_oid
Definition types.hpp:318
bool operator!=(b_oid const &lhs, b_oid const &rhs)
free function comparator for b_oid
Definition types.hpp:760
A BSON regex value.
Definition types.hpp:423
bool operator!=(b_regex const &lhs, b_regex const &rhs)
free function comparator for b_regex
Definition types.hpp:796
b_regex(T &®ex, U &&options=U{})
Constructor for b_regex.
Definition types.hpp:436
bool operator==(b_regex const &lhs, b_regex const &rhs)
free function comparator for b_regex
Definition types.hpp:447
A BSON UTF-8 encoded string value.
Definition types.hpp:177
b_string(T &&t)
Constructor for b_string.
Definition types.hpp:187
bool operator==(b_string const &lhs, b_string const &rhs)
free function comparator for b_string
Definition types.hpp:204
bool operator!=(b_string const &lhs, b_string const &rhs)
free function comparator for b_string
Definition types.hpp:715
A BSON Symbol value.
Definition types.hpp:511
b_symbol(T &&t)
Constructor for b_symbol.
Definition types.hpp:521
bool operator==(b_symbol const &lhs, b_symbol const &rhs)
free function comparator for b_symbol
Definition types.hpp:538
bool operator!=(b_symbol const &lhs, b_symbol const &rhs)
free function comparator for b_symbol
Definition types.hpp:823
A BSON replication timestamp value.
Definition types.hpp:601
bool operator==(b_timestamp const &lhs, b_timestamp const &rhs)
free function comparator for b_timestamp
Definition types.hpp:613
bool operator!=(b_timestamp const &lhs, b_timestamp const &rhs)
free function comparator for b_timestamp
Definition types.hpp:850
A BSON undefined value.
Definition types.hpp:291
bool operator!=(b_undefined const &lhs, b_undefined const &rhs)
free function comparator for b_undefined
Definition types.hpp:751
bool operator==(b_undefined const &, b_undefined const &)
free function comparator for b_undefined
Definition types.hpp:300
Declares entities used to represent BSON types.
#define BSONCXX_V1_TYPES_XMACRO(X)
X-macro over the name and value of BSON types.
Definition id-fwd.hpp:44
Provides enumerations identifying the type of a BSON element.
Provides non-owning, read-only entities representing a BSON type value.
Provides bsoncxx::v_noabi::array::view.
Provides bsoncxx::v_noabi::decimal128.
Provides bsoncxx::v_noabi::document::view.
Provides bsoncxx::v_noabi::oid.
Provides std::string_view-related polyfills for library API usage.