62 using is_value = detail::is_alike<T, value>;
65 using from_v1_expr =
decltype(
from_v1(std::declval<T>()));
68 struct has_from_v1 : detail::conjunction<detail::negation<is_value<T>>, detail::is_detected<from_v1_expr, T>> {};
85 template <typename T, detail::enable_if_t<has_from_v1<T>::value>* =
nullptr>
88#pragma push_macro("X")
90#define X(_name, _unused) \
91 value(v_noabi::types::b_##_name v) : _value{to_v1(v)} {}
100#pragma pop_macro("X")
110 value(std::string v) : _value{std::move(v)} {}
120 value(std::int32_t v) : _value{v} {}
125 value(std::int64_t v) : _value{v} {}
150 value(std::chrono::milliseconds v) : _value{v} {}
155 value(std::nullptr_t) : _value{nullptr} {}
177 : _value{reinterpret_cast<std::uint8_t const*>(v.data()), v.size(),
to_v1(sub_type)} {}
191 : _value{data, size,
to_v1(sub_type)} {}
292 return std::move(_value);
324 return _value.
view();
331 return _value.
view();
334#pragma push_macro("X")
336#define X(_name, _value) \
337 v_noabi::types::b_##_name const& get_##_name() const { \
338 return this->view().get_##_name(); \
351#pragma pop_macro("X")
366 return !(lhs == rhs);
379 return (lhs.
view() == rhs);
389 return !(lhs == rhs);
394 return !(lhs == rhs);
412 return {std::move(v)};
429using v_noabi::types::bson_value::operator==;
430using v_noabi::types::bson_value::operator!=;
Provides bsoncxx::v_noabi::array::view_or_value.
#define BSONCXX_ABI_EXPORT_CDECL_UNSTABLE(...)
Equivalent to BSONCXX_ABI_EXPORT_UNSTABLE with BSONCXX_ABI_CDECL.
Definition config.hpp:28
The bsoncxx v_noabi macro guard postlude header.
The bsoncxx v_noabi macro guard prelude header.
value()=default
Initialize with bsoncxx::v1::types::b_null.
A polyfill for std::string_view.
Definition string_view.hpp:412
A union of BSON type values.
Definition value.hpp:52
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
An owning variant type that represents any BSON type.
Definition value.hpp:57
value(T v)
Construct with the bsoncxx::v1 equivalent.
Definition value.hpp:86
bool operator!=(value const &lhs, view const &rhs)
Compares a value with a view for (in)equality.
Definition value.hpp:388
value(v_noabi::document::view v)
Constructs a BSON document value.
Definition value.hpp:160
value(v_noabi::decimal128 v)
Constructs a BSON Decimal128 value.
Definition value.hpp:145
value(v1::stdx::string_view v)
Constructs a BSON UTF-8 string value.
Definition value.hpp:115
bool operator==(value const &lhs, value const &rhs)
Compares values for (in)-equality.
Definition value.hpp:360
value(v_noabi::array::view v)
Constructs a BSON array value.
Definition value.hpp:165
value(v1::stdx::string_view collection, v_noabi::oid value)
Constructs a BSON DBPointer value.
Definition value.hpp:203
value(char const *v)
Constructs a BSON UTF-8 string value.
Definition value.hpp:105
bool operator!=(view const &lhs, value const &rhs)
Compares a value with a view for (in)equality.
Definition value.hpp:393
value(std::uint8_t const *data, std::size_t size, v_noabi::binary_sub_type const sub_type={})
Constructs a BSON binary data value.
Definition value.hpp:190
value(v1::types::value v)
Construct with the bsoncxx::v1 equivalent.
Definition value.hpp:77
value(double v)
Constructs a BSON double value.
Definition value.hpp:130
v_noabi::type type_id() const
Equivalent to type() const.
Definition value.hpp:316
value(std::string v)
Constructs a BSON UTF-8 string value.
Definition value.hpp:110
bool operator==(value const &lhs, view const &rhs)
Compares a value with a view for (in)equality.
Definition value.hpp:378
bool operator==(view const &lhs, value const &rhs)
Compares a value with a view for (in)equality.
Definition value.hpp:383
v_noabi::types::bson_value::view view() const noexcept
Get a view over the bson_value owned by this object.
Definition value.hpp:323
value()=default
Initialize with bsoncxx::v1::types::b_null.
value(std::chrono::milliseconds v)
Constructs a BSON date value.
Definition value.hpp:150
v_noabi::type type() const
Returns the type of the underlying BSON value stored in this object.
Definition value.hpp:307
value(std::int32_t v)
Constructs a BSON 32-bit signed integer value.
Definition value.hpp:120
value(v1::stdx::string_view code, v_noabi::document::view_or_value scope)
Constructs a BSON JavaScript code with scope value.
Definition value.hpp:214
value(bool v)
Constructs a BSON boolean value.
Definition value.hpp:135
value(std::vector< unsigned char > v, v_noabi::binary_sub_type const sub_type={})
Constructs a BSON binary data value.
Definition value.hpp:176
bool operator!=(value const &lhs, value const &rhs)
Compares values for (in)-equality.
Definition value.hpp:365
value(v1::stdx::string_view regex, v1::stdx::string_view options)
Constructs a BSON regex value with options.
Definition value.hpp:225
value(v_noabi::oid v)
Constructs a BSON ObjectId value.
Definition value.hpp:140
value(std::int64_t v)
Constructs a BSON 64-bit signed integer value.
Definition value.hpp:125
value(std::nullptr_t)
Constructs a BSON null value.
Definition value.hpp:155
A non-owning variant that can contain any BSON type.
Definition view.hpp:62
v_noabi::type type_id() const
Equivalent to type() const.
Definition view.hpp:144
v_noabi::type type() const
Returns the type of the underlying BSON value stored in this object.
Definition view.hpp:135
view() noexcept
Default constructs a bson_value::view. The resulting view will be initialized to point at a bson_valu...
Definition view.hpp:80
Declares bsoncxx::v_noabi::document::element.
Provides bsoncxx::v_noabi::document::view_or_value.
Declares entities representing any BSON value type.
Declares entities representing BSON value types.
Declares entities whose ABI stability is guaranteed for documented symbols.
v_noabi::view_or_value< v_noabi::document::view, v_noabi::document::value > view_or_value
Equivalent to v_noabi::view_or_value<v_noabi::document::view, v_noabi::document::value>.
Definition view_or_value.hpp:30
Declares C++17 standard library polyfills.
Declares entities representing any BSON value type.
Declares entities representing BSON value types.
Declares entities whose ABI stability is NOT guaranteed.
binary_sub_type
An enumeration of each BSON binary sub type.
Definition types.hpp:78
type
An enumeration of each BSON type.
Definition types.hpp:47
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:263
The top-level namespace within which all bsoncxx library entities are declared.
A BSON regex value.
Definition types.hpp:423
#define BSONCXX_V1_TYPES_XMACRO(X)
X-macro over the name and value of BSON types.
Definition id-fwd.hpp:44
Provides bsoncxx::v1::types::value.
Declares bsoncxx::v_noabi::types::bson_value::value.
Provides bsoncxx::v_noabi::types::bson_value::view.