Loading...
Searching...
No Matches
types.hpp
Go to the documentation of this file.
// Copyright 2009-present MongoDB, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#pragma once
#include <bsoncxx/types-fwd.hpp> // IWYU pragma: export
//
#include <bsoncxx/v1/detail/type_traits.hpp>
#include <bsoncxx/v1/types/id.hpp> // IWYU pragma: export
#include <bsoncxx/v1/types/view.hpp> // IWYU pragma: export
#include <chrono>
#include <cstring>
#include <string>
#include <bsoncxx/array/view.hpp>
#include <bsoncxx/decimal128.hpp>
#include <bsoncxx/document/view.hpp>
#include <bsoncxx/oid.hpp>
#include <bsoncxx/stdx/string_view.hpp>
#include <bsoncxx/config/prelude.hpp>
namespace bsoncxx {
namespace v_noabi {
enum class type : std::uint8_t {
k_double = 0x01,
k_string = 0x02,
k_document = 0x03,
k_array = 0x04,
k_binary = 0x05,
k_undefined = 0x06,
k_oid = 0x07,
k_bool = 0x08,
k_date = 0x09,
k_null = 0x0A,
k_regex = 0x0B,
k_dbpointer = 0x0C,
k_code = 0x0D,
k_symbol = 0x0E,
k_codewscope = 0x0F,
k_int32 = 0x10,
k_timestamp = 0x11,
k_int64 = 0x12,
k_decimal128 = 0x13,
k_maxkey = 0x7F,
k_minkey = 0xFF,
};
enum class binary_sub_type : std::uint8_t {
k_binary = 0x00,
k_function = 0x01,
k_binary_deprecated = 0x02,
k_uuid_deprecated = 0x03,
k_uuid = 0x04,
k_md5 = 0x05,
k_encrypted = 0x06,
k_column = 0x07,
k_sensitive = 0x08,
k_vector = 0x09,
k_user = 0x80,
};
inline type from_v1(v1::types::id v) {
return static_cast<type>(v);
}
inline v1::types::id to_v1(type v) {
return static_cast<v1::types::id>(v);
}
inline binary_sub_type from_v1(v1::types::binary_subtype v) {
return static_cast<binary_sub_type>(v);
}
inline v1::types::binary_subtype to_v1(binary_sub_type v) {
return static_cast<v1::types::binary_subtype>(v);
}
inline std::string to_string(type rhs) {
return v1::types::to_string(to_v1(rhs));
}
inline std::string to_string(binary_sub_type rhs) {
return v1::types::to_string(to_v1(rhs));
}
namespace types {
struct b_double {
static constexpr auto type_id = type::k_double;
double value;
operator double() const {
return value;
}
};
inline bool operator==(b_double const& lhs, b_double const& rhs) {
BSONCXX_PRIVATE_WARNINGS_PUSH();
BSONCXX_PRIVATE_WARNINGS_DISABLE(GNU("-Wfloat-equal"));
return lhs.value == rhs.value;
BSONCXX_PRIVATE_WARNINGS_POP();
}
struct b_string {
static constexpr auto type_id = type::k_string;
template <typename T, detail::requires_not_t<int, detail::is_alike<b_string, T>> = 0>
explicit b_string(T&& t) : value(std::forward<T>(t)) {}
stdx::string_view value;
operator stdx::string_view() const {
return value;
}
};
inline bool operator==(b_string const& lhs, b_string const& rhs) {
return lhs.value == rhs.value;
}
struct b_document {
static constexpr auto type_id = type::k_document;
document::view value;
operator document::view() const {
return value;
}
document::view view() {
return value;
}
};
inline bool operator==(b_document const& lhs, b_document const& rhs) {
return lhs.value == rhs.value;
}
struct b_array {
static constexpr auto type_id = type::k_array;
array::view value;
operator array::view() const {
return value;
}
};
inline bool operator==(b_array const& lhs, b_array const& rhs) {
return lhs.value == rhs.value;
}
struct b_binary {
static constexpr auto type_id = type::k_binary;
binary_sub_type sub_type;
uint32_t size;
uint8_t const* bytes;
};
inline bool operator==(b_binary const& lhs, b_binary const& rhs) {
return lhs.sub_type == rhs.sub_type && lhs.size == rhs.size &&
(!lhs.size || (std::memcmp(lhs.bytes, rhs.bytes, lhs.size) == 0));
}
struct b_undefined {
static constexpr auto type_id = type::k_undefined;
};
inline bool operator==(b_undefined const&, b_undefined const&) {
return true;
}
struct b_oid {
static constexpr auto type_id = type::k_oid;
oid value;
};
inline bool operator==(b_oid const& lhs, b_oid const& rhs) {
return lhs.value == rhs.value;
}
struct b_bool {
static constexpr auto type_id = type::k_bool;
bool value;
operator bool() const {
return value;
}
};
inline bool operator==(b_bool const& lhs, b_bool const& rhs) {
return lhs.value == rhs.value;
}
struct b_date {
static constexpr auto type_id = type::k_date;
explicit b_date(std::chrono::milliseconds value) : value(value) {}
explicit b_date(std::chrono::system_clock::time_point const& tp)
: value(std::chrono::duration_cast<std::chrono::milliseconds>(tp.time_since_epoch())) {}
std::chrono::milliseconds value;
operator int64_t() const {
return value.count();
}
int64_t to_int64() const {
return value.count();
}
operator std::chrono::system_clock::time_point() const {
return std::chrono::system_clock::time_point(
std::chrono::duration_cast<std::chrono::system_clock::duration>(value));
}
};
inline bool operator==(b_date const& lhs, b_date const& rhs) {
return lhs.value == rhs.value;
}
struct b_null {
static constexpr auto type_id = type::k_null;
};
inline bool operator==(b_null const&, b_null const&) {
return true;
}
struct b_regex {
static constexpr auto type_id = type::k_regex;
template <typename T, typename U = stdx::string_view, detail::requires_not_t<int, detail::is_alike<b_regex, T>> = 0>
explicit b_regex(T&& regex, U&& options = U{}) : regex(std::forward<T>(regex)), options(std::forward<U>(options)) {}
stdx::string_view regex;
stdx::string_view options;
};
inline bool operator==(b_regex const& lhs, b_regex const& rhs) {
return lhs.regex == rhs.regex && lhs.options == rhs.options;
}
struct b_dbpointer {
static constexpr auto type_id = type::k_dbpointer;
stdx::string_view collection;
oid value;
};
inline bool operator==(b_dbpointer const& lhs, b_dbpointer const& rhs) {
return lhs.collection == rhs.collection && lhs.value == rhs.value;
}
struct b_code {
static constexpr auto type_id = type::k_code;
template <typename T, detail::requires_not_t<int, detail::is_alike<b_code, T>> = 0>
explicit b_code(T&& t) : code(std::forward<T>(t)) {}
stdx::string_view code;
operator stdx::string_view() const {
return code;
}
};
inline bool operator==(b_code const& lhs, b_code const& rhs) {
return lhs.code == rhs.code;
}
struct b_symbol {
static constexpr auto type_id = type::k_symbol;
template <typename T, detail::requires_not_t<int, detail::is_alike<b_symbol, T>> = 0>
explicit b_symbol(T&& t) : symbol(std::forward<T>(t)) {}
stdx::string_view symbol;
operator stdx::string_view() const {
return symbol;
}
};
inline bool operator==(b_symbol const& lhs, b_symbol const& rhs) {
return lhs.symbol == rhs.symbol;
}
struct b_codewscope {
static constexpr auto type_id = type::k_codewscope;
template <typename T, typename U, detail::requires_not_t<int, detail::is_alike<b_codewscope, T>> = 0>
explicit b_codewscope(T&& code, U&& scope) : code(std::forward<T>(code)), scope(std::forward<U>(scope)) {}
stdx::string_view code;
document::view scope;
};
inline bool operator==(b_codewscope const& lhs, b_codewscope const& rhs) {
return lhs.code == rhs.code && lhs.scope == rhs.scope;
}
struct b_int32 {
static constexpr auto type_id = type::k_int32;
int32_t value;
operator int32_t() const {
return value;
}
};
inline bool operator==(b_int32 const& lhs, b_int32 const& rhs) {
return lhs.value == rhs.value;
}
struct b_timestamp {
static constexpr auto type_id = type::k_timestamp;
uint32_t increment;
uint32_t timestamp;
};
inline bool operator==(b_timestamp const& lhs, b_timestamp const& rhs) {
return lhs.increment == rhs.increment && lhs.timestamp == rhs.timestamp;
}
struct b_int64 {
static constexpr auto type_id = type::k_int64;
int64_t value;
operator int64_t() const {
return value;
}
};
inline bool operator==(b_int64 const& lhs, b_int64 const& rhs) {
return lhs.value == rhs.value;
}
struct b_decimal128 {
static constexpr auto type_id = type::k_decimal128;
decimal128 value;
template <typename T, detail::requires_not_t<int, detail::is_alike<b_decimal128, T>> = 0>
explicit b_decimal128(T&& t) : value(std::forward<T>(t)) {}
};
inline bool operator==(b_decimal128 const& lhs, b_decimal128 const& rhs) {
return lhs.value == rhs.value;
}
struct b_minkey {
static constexpr auto type_id = type::k_minkey;
};
inline bool operator==(b_minkey const&, b_minkey const&) {
return true;
}
struct b_maxkey {
static constexpr auto type_id = type::k_maxkey;
};
inline bool operator==(b_maxkey const&, b_maxkey const&) {
return true;
}
inline bool operator!=(b_double const& lhs, b_double const& rhs) {
return !(lhs == rhs);
}
inline bool operator!=(b_string const& lhs, b_string const& rhs) {
return !(lhs == rhs);
}
inline bool operator!=(b_document const& lhs, b_document const& rhs) {
return !(lhs == rhs);
}
inline bool operator!=(b_array const& lhs, b_array const& rhs) {
return !(lhs == rhs);
}
inline bool operator!=(b_binary const& lhs, b_binary const& rhs) {
return !(lhs == rhs);
}
inline bool operator!=(b_undefined const& lhs, b_undefined const& rhs) {
return !(lhs == rhs);
}
inline bool operator!=(b_oid const& lhs, b_oid const& rhs) {
return !(lhs == rhs);
}
inline bool operator!=(b_bool const& lhs, b_bool const& rhs) {
return !(lhs == rhs);
}
inline bool operator!=(b_date const& lhs, b_date const& rhs) {
return !(lhs == rhs);
}
inline bool operator!=(b_null const& lhs, b_null const& rhs) {
return !(lhs == rhs);
}
inline bool operator!=(b_regex const& lhs, b_regex const& rhs) {
return !(lhs == rhs);
}
inline bool operator!=(b_dbpointer const& lhs, b_dbpointer const& rhs) {
return !(lhs == rhs);
}
inline bool operator!=(b_code const& lhs, b_code const& rhs) {
return !(lhs == rhs);
}
inline bool operator!=(b_symbol const& lhs, b_symbol const& rhs) {
return !(lhs == rhs);
}
inline bool operator!=(b_codewscope const& lhs, b_codewscope const& rhs) {
return !(lhs == rhs);
}
inline bool operator!=(b_int32 const& lhs, b_int32 const& rhs) {
return !(lhs == rhs);
}
inline bool operator!=(b_timestamp const& lhs, b_timestamp const& rhs) {
return !(lhs == rhs);
}
inline bool operator!=(b_int64 const& lhs, b_int64 const& rhs) {
return !(lhs == rhs);
}
inline bool operator!=(b_decimal128 const& lhs, b_decimal128 const& rhs) {
return !(lhs == rhs);
}
inline bool operator!=(b_minkey const& lhs, b_minkey const& rhs) {
return !(lhs == rhs);
}
inline bool operator!=(b_maxkey const& lhs, b_maxkey const& rhs) {
return !(lhs == rhs);
}
#pragma push_macro("X")
#undef X
#define X(_name, _val) BSONCXX_PRIVATE_INLINE_CXX17 constexpr type b_##_name::type_id;
BSONCXX_V1_TYPES_XMACRO(X)
#pragma pop_macro("X")
} // namespace types
// BSONCXX_V1_TYPES_XMACRO: update below.
inline v_noabi::types::b_double from_v1(v1::types::b_double const& v) {
return {v.value};
}
inline v_noabi::types::b_string from_v1(v1::types::b_string const& v) {
return v_noabi::types::b_string{v.value};
}
inline v_noabi::types::b_document from_v1(v1::types::b_document const& v) {
return {v.value};
}
inline v_noabi::types::b_array from_v1(v1::types::b_array const& v) {
return {v.value};
}
inline v_noabi::types::b_binary from_v1(v1::types::b_binary const& v) {
return {from_v1(v.subtype), v.size, v.bytes};
}
inline v_noabi::types::b_undefined from_v1(v1::types::b_undefined const& v) {
(void)v;
return {};
}
inline v_noabi::types::b_oid from_v1(v1::types::b_oid const& v) {
return {v.value};
}
inline v_noabi::types::b_bool from_v1(v1::types::b_bool const& v) {
return {v.value};
}
inline v_noabi::types::b_date from_v1(v1::types::b_date const& v) {
return v_noabi::types::b_date{v.value};
}
inline v_noabi::types::b_null from_v1(v1::types::b_null const& v) {
(void)v;
return {};
}
inline v_noabi::types::b_regex from_v1(v1::types::b_regex const& v) {
return v_noabi::types::b_regex{v.regex, v.options};
}
inline v_noabi::types::b_dbpointer from_v1(v1::types::b_dbpointer const& v) {
return {v.collection, v.value};
}
inline v_noabi::types::b_code from_v1(v1::types::b_code const& v) {
return v_noabi::types::b_code{v.code};
}
inline v_noabi::types::b_symbol from_v1(v1::types::b_symbol const& v) {
return v_noabi::types::b_symbol{v.symbol};
}
inline v_noabi::types::b_codewscope from_v1(v1::types::b_codewscope const& v) {
return v_noabi::types::b_codewscope{v.code, v.scope};
}
inline v_noabi::types::b_int32 from_v1(v1::types::b_int32 const& v) {
return {v.value};
}
inline v_noabi::types::b_timestamp from_v1(v1::types::b_timestamp const& v) {
return {v.increment, v.timestamp};
}
inline v_noabi::types::b_int64 from_v1(v1::types::b_int64 const& v) {
return {v.value};
}
inline v_noabi::types::b_decimal128 from_v1(v1::types::b_decimal128 const& v) {
return v_noabi::types::b_decimal128{v.value};
}
inline v_noabi::types::b_maxkey from_v1(v1::types::b_maxkey const& v) {
(void)v;
return {};
}
inline v_noabi::types::b_minkey from_v1(v1::types::b_minkey const& v) {
(void)v;
return {};
}
inline v1::types::b_double to_v1(v_noabi::types::b_double const& v) {
return v1::types::b_double{v.value};
}
inline v1::types::b_string to_v1(v_noabi::types::b_string const& v) {
return v1::types::b_string{v.value};
}
inline v1::types::b_document to_v1(v_noabi::types::b_document const& v) {
return v1::types::b_document{to_v1(v.value)};
}
inline v1::types::b_array to_v1(v_noabi::types::b_array const& v) {
return v1::types::b_array{to_v1(v.value)};
}
inline v1::types::b_binary to_v1(v_noabi::types::b_binary const& v) {
return v1::types::b_binary{to_v1(v.sub_type), v.size, v.bytes};
}
inline v1::types::b_undefined to_v1(v_noabi::types::b_undefined const& v) {
(void)v;
return v1::types::b_undefined{};
}
inline v1::types::b_oid to_v1(v_noabi::types::b_oid const& v) {
return v1::types::b_oid{to_v1(v.value)};
}
inline v1::types::b_bool to_v1(v_noabi::types::b_bool const& v) {
return v1::types::b_bool{v.value};
}
inline v1::types::b_date to_v1(v_noabi::types::b_date const& v) {
return v1::types::b_date{v.value};
}
inline v1::types::b_null to_v1(v_noabi::types::b_null const& v) {
(void)v;
return v1::types::b_null{};
}
inline v1::types::b_regex to_v1(v_noabi::types::b_regex const& v) {
return v1::types::b_regex{v.regex, v.options};
}
inline v1::types::b_dbpointer to_v1(v_noabi::types::b_dbpointer const& v) {
return v1::types::b_dbpointer{v.collection, to_v1(v.value)};
}
inline v1::types::b_code to_v1(v_noabi::types::b_code const& v) {
return v1::types::b_code{v.code};
}
inline v1::types::b_symbol to_v1(v_noabi::types::b_symbol const& v) {
return v1::types::b_symbol{v.symbol};
}
inline v1::types::b_codewscope to_v1(v_noabi::types::b_codewscope const& v) {
return v1::types::b_codewscope{v.code, to_v1(v.scope)};
}
inline v1::types::b_int32 to_v1(v_noabi::types::b_int32 const& v) {
return v1::types::b_int32{v.value};
}
inline v1::types::b_timestamp to_v1(v_noabi::types::b_timestamp const& v) {
return v1::types::b_timestamp{v.increment, v.timestamp};
}
inline v1::types::b_int64 to_v1(v_noabi::types::b_int64 const& v) {
return v1::types::b_int64{v.value};
}
inline v1::types::b_decimal128 to_v1(v_noabi::types::b_decimal128 const& v) {
return v1::types::b_decimal128{to_v1(v.value)};
}
inline v1::types::b_maxkey to_v1(v_noabi::types::b_maxkey const& v) {
(void)v;
return v1::types::b_maxkey{};
}
inline v1::types::b_minkey to_v1(v_noabi::types::b_minkey const& v) {
(void)v;
return v1::types::b_minkey{};
}
// BSONCXX_V1_TYPES_XMACRO: update above.
} // namespace v_noabi
} // namespace bsoncxx
namespace bsoncxx {
using v_noabi::to_string;
} // namespace bsoncxx
namespace bsoncxx {
namespace types {
using v_noabi::types::operator==;
using v_noabi::types::operator!=;
} // namespace types
} // namespace bsoncxx
#include <bsoncxx/config/postlude.hpp>
postlude.hpp
The bsoncxx v_noabi macro guard postlude header.
prelude.hpp
The bsoncxx v_noabi macro guard prelude header.
bsoncxx::v1::stdx::string_view
A polyfill for std::string_view.
Definition string_view.hpp:412
bsoncxx::v_noabi::array::view
A read-only, non-owning view of a BSON document.
Definition view.hpp:41
bsoncxx::v_noabi::decimal128
Represents a MongoDB BSON Decimal128.
Definition decimal128.hpp:45
bsoncxx::v_noabi::document::view
A read-only, non-owning view of a BSON document.
Definition view.hpp:40
bsoncxx::v_noabi::oid
Represents a MongoDB BSON ObjectId.
Definition oid.hpp:41
bsoncxx::types
Declares entities representing BSON value types.
bsoncxx::v1::types::to_string
std::string to_string(id rhs)
Return the name of the enumerator (e.g. "double" given k_double).
bsoncxx::v1::types::binary_subtype
binary_subtype
Enumeration identifying a BSON binary subtype.
Definition id.hpp:71
bsoncxx::v1::types::id
id
Enumeration identifying a BSON type.
Definition id.hpp:37
bsoncxx::v_noabi::types::value
bson_value::value value
Equivalent to bsoncxx::v_noabi::types::bson_value::value.
Definition value-fwd.hpp:35
bsoncxx::v_noabi
Declares entities whose ABI stability is NOT guaranteed.
bsoncxx::v_noabi::binary_sub_type
binary_sub_type
An enumeration of each BSON binary sub type.
Definition types.hpp:78
bsoncxx::v_noabi::binary_sub_type::k_uuid
@ k_uuid
UUID.
Definition types.hpp:83
bsoncxx::v_noabi::binary_sub_type::k_binary_deprecated
@ k_binary_deprecated
Binary (Old).
Definition types.hpp:81
bsoncxx::v_noabi::binary_sub_type::k_sensitive
@ k_sensitive
Sensitive.
Definition types.hpp:87
bsoncxx::v_noabi::binary_sub_type::k_md5
@ k_md5
MD5.
Definition types.hpp:84
bsoncxx::v_noabi::binary_sub_type::k_user
@ k_user
User defined.
Definition types.hpp:89
bsoncxx::v_noabi::binary_sub_type::k_function
@ k_function
Function.
Definition types.hpp:80
bsoncxx::v_noabi::binary_sub_type::k_column
@ k_column
Compressed BSON column.
Definition types.hpp:86
bsoncxx::v_noabi::binary_sub_type::k_uuid_deprecated
@ k_uuid_deprecated
UUID (Old).
Definition types.hpp:82
bsoncxx::v_noabi::binary_sub_type::k_encrypted
@ k_encrypted
Encrypted BSON value.
Definition types.hpp:85
bsoncxx::v_noabi::binary_sub_type::k_vector
@ k_vector
BSON Binary Vector.
Definition types.hpp:88
bsoncxx::v_noabi::to_string
std::string to_string(type rhs)
Returns a stringification of the given type.
Definition types.hpp:128
bsoncxx::v_noabi::type
type
An enumeration of each BSON type.
Definition types.hpp:47
bsoncxx::v_noabi::type::k_decimal128
@ k_decimal128
128-bit decimal floating point.
Definition types.hpp:66
bsoncxx::v_noabi::type::k_minkey
@ k_minkey
Min key.
Definition types.hpp:68
bsoncxx::v_noabi::type::k_double
@ k_double
64-bit binary floating point.
Definition types.hpp:48
bsoncxx::v_noabi::type::k_dbpointer
@ k_dbpointer
DBPointer.
Definition types.hpp:59
bsoncxx::v_noabi::type::k_int64
@ k_int64
64-bit integer.
Definition types.hpp:65
bsoncxx::v_noabi::type::k_codewscope
@ k_codewscope
JavaScript code with scope.
Definition types.hpp:62
bsoncxx::v_noabi::type::k_regex
@ k_regex
Regular expression.
Definition types.hpp:58
bsoncxx::v_noabi::type::k_string
@ k_string
UTF-8 string.
Definition types.hpp:49
bsoncxx::v_noabi::type::k_array
@ k_array
Array.
Definition types.hpp:51
bsoncxx::v_noabi::type::k_bool
@ k_bool
Boolean.
Definition types.hpp:55
bsoncxx::v_noabi::type::k_symbol
@ k_symbol
Symbol.
Definition types.hpp:61
bsoncxx::v_noabi::type::k_oid
@ k_oid
ObjectId.
Definition types.hpp:54
bsoncxx::v_noabi::type::k_date
@ k_date
UTC datetime.
Definition types.hpp:56
bsoncxx::v_noabi::type::k_int32
@ k_int32
32-bit integer.
Definition types.hpp:63
bsoncxx::v_noabi::type::k_timestamp
@ k_timestamp
Timestamp.
Definition types.hpp:64
bsoncxx::v_noabi::type::k_undefined
@ k_undefined
Undefined value.
Definition types.hpp:53
bsoncxx::v_noabi::type::k_code
@ k_code
JavaScript code.
Definition types.hpp:60
bsoncxx::v_noabi::type::k_document
@ k_document
Embedded document.
Definition types.hpp:50
bsoncxx::v_noabi::type::k_maxkey
@ k_maxkey
Max key.
Definition types.hpp:67
bsoncxx::v_noabi::type::k_binary
@ k_binary
Binary data.
Definition types.hpp:52
bsoncxx::v_noabi::type::k_null
@ k_null
Null value.
Definition types.hpp:57
bsoncxx::v_noabi::to_v1
v1::element::view to_v1(v_noabi::array::element const &v)
Convert to the bsoncxx::v1 equivalent of v.
Definition element.hpp:132
bsoncxx::v_noabi::from_v1
v_noabi::array::value from_v1(v1::array::value const &v)
Convert from the bsoncxx::v1 equivalent of v.
Definition value.hpp:263
bsoncxx
The top-level namespace within which all bsoncxx library entities are declared.
bsoncxx::types::b_code::b_code
b_code(T &&t)
Constructor for b_code.
Definition types.hpp:485
bsoncxx::types::b_codewscope::b_codewscope
b_codewscope(T &&code, U &&scope)
Constructor for b_codewscope.
Definition types.hpp:558
bsoncxx::types::b_date::b_date
b_date(std::chrono::milliseconds value)
Constructor for b_date.
Definition types.hpp:359
bsoncxx::types::b_decimal128::b_decimal128
b_decimal128(T &&t)
Constructor for b_decimal128.
Definition types.hpp:657
bsoncxx::types::b_regex::b_regex
b_regex(T &&regex, U &&options=U{})
Constructor for b_regex.
Definition types.hpp:436
bsoncxx::types::b_string::b_string
b_string(T &&t)
Constructor for b_string.
Definition types.hpp:187
bsoncxx::types::b_symbol::b_symbol
b_symbol(T &&t)
Constructor for b_symbol.
Definition types.hpp:521
bsoncxx::v1::types::b_array
BSON type value "Array".
Definition view.hpp:193
bsoncxx::v1::types::b_array::value
v1::array::view value
The represented value.
Definition view.hpp:202
bsoncxx::v1::types::b_binary
BSON type value "Binary Data".
Definition view.hpp:239
bsoncxx::v1::types::b_binary::subtype
binary_subtype subtype
The represented value's binary subtype component.
Definition view.hpp:248
bsoncxx::v1::types::b_binary::bytes
std::uint8_t const * bytes
The represented value's binary data.
Definition view.hpp:258
bsoncxx::v1::types::b_binary::size
std::uint32_t size
The represented value's length of binary data.
Definition view.hpp:253
bsoncxx::v1::types::b_bool
BSON type value "Boolean".
Definition view.hpp:376
bsoncxx::v1::types::b_bool::value
bool value
The represented value.
Definition view.hpp:385
bsoncxx::v1::types::b_code
BSON type value "JavaScript Code".
Definition view.hpp:598
bsoncxx::v1::types::b_code::code
v1::stdx::string_view code
The represented value.
Definition view.hpp:607
bsoncxx::v1::types::b_codewscope
BSON type value "JavaScript Code With Scope".
Definition view.hpp:694
bsoncxx::v1::types::b_codewscope::scope
v1::document::view scope
The represented value's "$scope" component.
Definition view.hpp:708
bsoncxx::v1::types::b_codewscope::code
v1::stdx::string_view code
The represented value's "$code" component.
Definition view.hpp:703
bsoncxx::v1::types::b_date
BSON type value "UTC Datetime".
Definition view.hpp:422
bsoncxx::v1::types::b_date::value
std::chrono::milliseconds value
The represented value (milliseconds relative to the Unix epoch).
Definition view.hpp:431
bsoncxx::v1::types::b_dbpointer
BSON type value "DBPointer".
Definition view.hpp:554
bsoncxx::v1::types::b_dbpointer::value
v1::oid value
The represented value's "$id" (ObjectID) component.
Definition view.hpp:568
bsoncxx::v1::types::b_dbpointer::collection
v1::stdx::string_view collection
The represented value's "$ref" (namespace) component.
Definition view.hpp:563
bsoncxx::v1::types::b_decimal128
BSON type value "Decimal128".
Definition view.hpp:874
bsoncxx::v1::types::b_decimal128::value
v1::decimal128 value
The represented value.
Definition view.hpp:883
bsoncxx::v1::types::b_document
BSON type value "Embedded Document".
Definition view.hpp:143
bsoncxx::v1::types::b_document::value
v1::document::view value
The represented value.
Definition view.hpp:152
bsoncxx::v1::types::b_double
BSON type value "64-bit Binary Floating Point".
Definition view.hpp:48
bsoncxx::v1::types::b_double::value
double value
The represented value.
Definition view.hpp:57
bsoncxx::v1::types::b_int32
BSON type value "32-bit Integer".
Definition view.hpp:738
bsoncxx::v1::types::b_int32::value
std::int32_t value
The represented value.
Definition view.hpp:747
bsoncxx::v1::types::b_int64
BSON type value "64-bit Integer".
Definition view.hpp:828
bsoncxx::v1::types::b_int64::value
std::int64_t value
The represented value.
Definition view.hpp:837
bsoncxx::v1::types::b_maxkey
BSON type value "Max Key".
Definition view.hpp:920
bsoncxx::v1::types::b_minkey
BSON type value "Min Key".
Definition view.hpp:944
bsoncxx::v1::types::b_null
BSON type value "Null Value".
Definition view.hpp:479
bsoncxx::v1::types::b_oid
BSON type value "ObjectID".
Definition view.hpp:330
bsoncxx::v1::types::b_oid::value
v1::oid value
The represented value.
Definition view.hpp:339
bsoncxx::v1::types::b_regex
BSON type value "Regular Expression".
Definition view.hpp:503
bsoncxx::v1::types::b_regex::regex
v1::stdx::string_view regex
The represented value's "pattern" component.
Definition view.hpp:512
bsoncxx::v1::types::b_regex::options
v1::stdx::string_view options
The represented value's "options" component.
Definition view.hpp:517
bsoncxx::v1::types::b_string
BSON type value "UTF-8 String".
Definition view.hpp:97
bsoncxx::v1::types::b_string::value
v1::stdx::string_view value
The represented value.
Definition view.hpp:106
bsoncxx::v1::types::b_symbol
BSON type value "Symbol".
Definition view.hpp:646
bsoncxx::v1::types::b_symbol::symbol
v1::stdx::string_view symbol
The represented value.
Definition view.hpp:655
bsoncxx::v1::types::b_timestamp
BSON type value "Timestamp".
Definition view.hpp:784
bsoncxx::v1::types::b_timestamp::increment
std::uint32_t increment
The represented value's "i" component.
Definition view.hpp:793
bsoncxx::v1::types::b_timestamp::timestamp
std::uint32_t timestamp
The represented value's "t" component.
Definition view.hpp:798
bsoncxx::v1::types::b_undefined
BSON type value "Undefined (Value)".
Definition view.hpp:306
bsoncxx::v_noabi::types::b_array
A BSON array value.
Definition types.hpp:243
bsoncxx::v_noabi::types::b_array::operator==
bool operator==(b_array const &lhs, b_array const &rhs)
free function comparator for b_array
Definition types.hpp:261
bsoncxx::v_noabi::types::b_array::operator!=
bool operator!=(b_array const &lhs, b_array const &rhs)
free function comparator for b_array
Definition types.hpp:733
bsoncxx::v_noabi::types::b_binary
A BSON binary data value.
Definition types.hpp:268
bsoncxx::v_noabi::types::b_binary::operator==
bool operator==(b_binary const &lhs, b_binary const &rhs)
free function comparator for b_binary
Definition types.hpp:281
bsoncxx::v_noabi::types::b_binary::operator!=
bool operator!=(b_binary const &lhs, b_binary const &rhs)
free function comparator for b_binary
Definition types.hpp:742
bsoncxx::v_noabi::types::b_bool
A BSON boolean value.
Definition types.hpp:325
bsoncxx::v_noabi::types::b_bool::operator!=
bool operator!=(b_bool const &lhs, b_bool const &rhs)
free function comparator for b_bool
Definition types.hpp:769
bsoncxx::v_noabi::types::b_bool::operator==
bool operator==(b_bool const &lhs, b_bool const &rhs)
free function comparator for b_bool
Definition types.hpp:343
bsoncxx::v_noabi::types::b_code
A BSON JavaScript code value.
Definition types.hpp:475
bsoncxx::v_noabi::types::b_code::operator!=
bool operator!=(b_code const &lhs, b_code const &rhs)
free function comparator for b_code
Definition types.hpp:814
bsoncxx::v_noabi::types::b_code::operator==
bool operator==(b_code const &lhs, b_code const &rhs)
free function comparator for b_code
Definition types.hpp:502
bsoncxx::v_noabi::types::b_code::b_code
b_code(T &&t)
Constructor for b_code.
Definition types.hpp:485
bsoncxx::v_noabi::types::b_codewscope
A BSON JavaScript code with scope value.
Definition types.hpp:545
bsoncxx::v_noabi::types::b_codewscope::operator==
bool operator==(b_codewscope const &lhs, b_codewscope const &rhs)
free function comparator for b_codewscope
Definition types.hpp:569
bsoncxx::v_noabi::types::b_codewscope::operator!=
bool operator!=(b_codewscope const &lhs, b_codewscope const &rhs)
free function comparator for b_codewscope
Definition types.hpp:832
bsoncxx::v_noabi::types::b_codewscope::b_codewscope
b_codewscope(T &&code, U &&scope)
Constructor for b_codewscope.
Definition types.hpp:558
bsoncxx::v_noabi::types::b_date
A BSON date value.
Definition types.hpp:350
bsoncxx::v_noabi::types::b_date::operator==
bool operator==(b_date const &lhs, b_date const &rhs)
free function comparator for b_date
Definition types.hpp:400
bsoncxx::v_noabi::types::b_date::operator!=
bool operator!=(b_date const &lhs, b_date const &rhs)
free function comparator for b_date
Definition types.hpp:778
bsoncxx::v_noabi::types::b_date::to_int64
int64_t to_int64() const
Manually convert this b_date to an int64_t.
Definition types.hpp:382
bsoncxx::v_noabi::types::b_date::b_date
b_date(std::chrono::system_clock::time_point const &tp)
Constructor for b_date.
Definition types.hpp:367
bsoncxx::v_noabi::types::b_date::b_date
b_date(std::chrono::milliseconds value)
Constructor for b_date.
Definition types.hpp:359
bsoncxx::v_noabi::types::b_dbpointer
A BSON DBPointer (aka DBRef) value.
Definition types.hpp:456
bsoncxx::v_noabi::types::b_dbpointer::operator==
bool operator==(b_dbpointer const &lhs, b_dbpointer const &rhs)
free function comparator for b_dbpointer
Definition types.hpp:468
bsoncxx::v_noabi::types::b_dbpointer::operator!=
bool operator!=(b_dbpointer const &lhs, b_dbpointer const &rhs)
free function comparator for b_dbpointer
Definition types.hpp:805
bsoncxx::v_noabi::types::b_decimal128
A BSON Decimal128 value.
Definition types.hpp:645
bsoncxx::v_noabi::types::b_decimal128::operator!=
bool operator!=(b_decimal128 const &lhs, b_decimal128 const &rhs)
free function comparator for b_decimal128
Definition types.hpp:868
bsoncxx::v_noabi::types::b_decimal128::operator==
bool operator==(b_decimal128 const &lhs, b_decimal128 const &rhs)
free function comparator for b_decimal128
Definition types.hpp:665
bsoncxx::v_noabi::types::b_decimal128::b_decimal128
b_decimal128(T &&t)
Constructor for b_decimal128.
Definition types.hpp:657
bsoncxx::v_noabi::types::b_document
A BSON document value.
Definition types.hpp:211
bsoncxx::v_noabi::types::b_document::operator==
bool operator==(b_document const &lhs, b_document const &rhs)
free function comparator for b_document
Definition types.hpp:236
bsoncxx::v_noabi::types::b_document::view
document::view view()
Returns an unwrapped document::view.
Definition types.hpp:226
bsoncxx::v_noabi::types::b_document::operator!=
bool operator!=(b_document const &lhs, b_document const &rhs)
free function comparator for b_document
Definition types.hpp:724
bsoncxx::v_noabi::types::b_double
A BSON double value.
Definition types.hpp:149
bsoncxx::v_noabi::types::b_double::operator!=
bool operator!=(b_double const &lhs, b_double const &rhs)
free function comparator for b_double
Definition types.hpp:706
bsoncxx::v_noabi::types::b_double::operator==
bool operator==(b_double const &lhs, b_double const &rhs)
free function comparator for b_double
Definition types.hpp:167
bsoncxx::v_noabi::types::b_int32
A BSON signed 32-bit integer value.
Definition types.hpp:576
bsoncxx::v_noabi::types::b_int32::operator==
bool operator==(b_int32 const &lhs, b_int32 const &rhs)
free function comparator for b_int32
Definition types.hpp:594
bsoncxx::v_noabi::types::b_int32::operator!=
bool operator!=(b_int32 const &lhs, b_int32 const &rhs)
free function comparator for b_int32
Definition types.hpp:841
bsoncxx::v_noabi::types::b_int64
A BSON 64-bit signed integer value.
Definition types.hpp:620
bsoncxx::v_noabi::types::b_int64::operator!=
bool operator!=(b_int64 const &lhs, b_int64 const &rhs)
free function comparator for b_int64
Definition types.hpp:859
bsoncxx::v_noabi::types::b_int64::operator==
bool operator==(b_int64 const &lhs, b_int64 const &rhs)
free function comparator for b_int64
Definition types.hpp:638
bsoncxx::v_noabi::types::b_maxkey
A BSON max-key value.
Definition types.hpp:688
bsoncxx::v_noabi::types::b_maxkey::operator!=
bool operator!=(b_maxkey const &lhs, b_maxkey const &rhs)
free function comparator for b_maxkey
Definition types.hpp:886
bsoncxx::v_noabi::types::b_maxkey::operator==
bool operator==(b_maxkey const &, b_maxkey const &)
free function comparator for b_maxkey
Definition types.hpp:697
bsoncxx::v_noabi::types::b_minkey
A BSON min-key value.
Definition types.hpp:672
bsoncxx::v_noabi::types::b_minkey::operator==
bool operator==(b_minkey const &, b_minkey const &)
free function comparator for b_minkey
Definition types.hpp:681
bsoncxx::v_noabi::types::b_minkey::operator!=
bool operator!=(b_minkey const &lhs, b_minkey const &rhs)
free function comparator for b_minkey
Definition types.hpp:877
bsoncxx::v_noabi::types::b_null
A BSON null value.
Definition types.hpp:407
bsoncxx::v_noabi::types::b_null::operator==
bool operator==(b_null const &, b_null const &)
free function comparator for b_null
Definition types.hpp:416
bsoncxx::v_noabi::types::b_null::operator!=
bool operator!=(b_null const &lhs, b_null const &rhs)
free function comparator for b_null
Definition types.hpp:787
bsoncxx::v_noabi::types::b_oid
A BSON ObjectId value.
Definition types.hpp:307
bsoncxx::v_noabi::types::b_oid::operator==
bool operator==(b_oid const &lhs, b_oid const &rhs)
free function comparator for b_oid
Definition types.hpp:318
bsoncxx::v_noabi::types::b_oid::operator!=
bool operator!=(b_oid const &lhs, b_oid const &rhs)
free function comparator for b_oid
Definition types.hpp:760
bsoncxx::v_noabi::types::b_regex
A BSON regex value.
Definition types.hpp:423
bsoncxx::v_noabi::types::b_regex::operator!=
bool operator!=(b_regex const &lhs, b_regex const &rhs)
free function comparator for b_regex
Definition types.hpp:796
bsoncxx::v_noabi::types::b_regex::b_regex
b_regex(T &&regex, U &&options=U{})
Constructor for b_regex.
Definition types.hpp:436
bsoncxx::v_noabi::types::b_regex::operator==
bool operator==(b_regex const &lhs, b_regex const &rhs)
free function comparator for b_regex
Definition types.hpp:447
bsoncxx::v_noabi::types::b_string
A BSON UTF-8 encoded string value.
Definition types.hpp:177
bsoncxx::v_noabi::types::b_string::b_string
b_string(T &&t)
Constructor for b_string.
Definition types.hpp:187
bsoncxx::v_noabi::types::b_string::operator==
bool operator==(b_string const &lhs, b_string const &rhs)
free function comparator for b_string
Definition types.hpp:204
bsoncxx::v_noabi::types::b_string::operator!=
bool operator!=(b_string const &lhs, b_string const &rhs)
free function comparator for b_string
Definition types.hpp:715
bsoncxx::v_noabi::types::b_symbol
A BSON Symbol value.
Definition types.hpp:511
bsoncxx::v_noabi::types::b_symbol::b_symbol
b_symbol(T &&t)
Constructor for b_symbol.
Definition types.hpp:521
bsoncxx::v_noabi::types::b_symbol::operator==
bool operator==(b_symbol const &lhs, b_symbol const &rhs)
free function comparator for b_symbol
Definition types.hpp:538
bsoncxx::v_noabi::types::b_symbol::operator!=
bool operator!=(b_symbol const &lhs, b_symbol const &rhs)
free function comparator for b_symbol
Definition types.hpp:823
bsoncxx::v_noabi::types::b_timestamp
A BSON replication timestamp value.
Definition types.hpp:601
bsoncxx::v_noabi::types::b_timestamp::operator==
bool operator==(b_timestamp const &lhs, b_timestamp const &rhs)
free function comparator for b_timestamp
Definition types.hpp:613
bsoncxx::v_noabi::types::b_timestamp::operator!=
bool operator!=(b_timestamp const &lhs, b_timestamp const &rhs)
free function comparator for b_timestamp
Definition types.hpp:850
bsoncxx::v_noabi::types::b_undefined
A BSON undefined value.
Definition types.hpp:291
bsoncxx::v_noabi::types::b_undefined::operator!=
bool operator!=(b_undefined const &lhs, b_undefined const &rhs)
free function comparator for b_undefined
Definition types.hpp:751
bsoncxx::v_noabi::types::b_undefined::operator==
bool operator==(b_undefined const &, b_undefined const &)
free function comparator for b_undefined
Definition types.hpp:300
types-fwd.hpp
Declares entities used to represent BSON types.
type_traits.hpp
For internal use only!
BSONCXX_V1_TYPES_XMACRO
#define BSONCXX_V1_TYPES_XMACRO(X)
X-macro over the name and value of BSON types.
Definition id-fwd.hpp:44
id.hpp
Provides enumerations identifying the type of a BSON element.
view.hpp
Provides non-owning, read-only entities representing a BSON type value.
view.hpp
Provides bsoncxx::v_noabi::array::view.
decimal128.hpp
Provides bsoncxx::v_noabi::decimal128.
view.hpp
Provides bsoncxx::v_noabi::document::view.
oid.hpp
Provides bsoncxx::v_noabi::oid.
string_view.hpp
Provides std::string_view-related polyfills for library API usage.