19 #include <type_traits>
21 #include <bsoncxx/stdx/type_traits.hpp>
22 #include <bsoncxx/types.hpp>
24 #include <bsoncxx/config/prelude.hpp>
27 inline namespace v_noabi {
33 namespace bson_value {
60 #define BSONCXX_ENUM(type, val) explicit view(b_##type) noexcept;
61 #include <bsoncxx/enums/type.hpp>
71 view& operator=(const
view&) noexcept;
82 friend BSONCXX_API
bool BSONCXX_CALL operator==(const bson_value::
view&,
83 const bson_value::
view&);
84 friend BSONCXX_API
bool BSONCXX_CALL operator!=(const bson_value::
view&,
85 const bson_value::
view&);
111 BSONCXX_DEPRECATED const
b_string& get_utf8() const;
274 friend class document::element;
275 friend class bson_value::
value;
277 view(const std::uint8_t* raw, std::uint32_t length, std::uint32_t offset, std::uint32_t keylen);
278 view(
void* internal_value) noexcept;
280 void _init(
void* internal_value) noexcept;
282 void BSONCXX_PRIVATE destroy() noexcept;
310 template <
typename T>
311 using is_bson_view_compatible = detail::conjunction<
312 std::is_constructible<bson_value::view, T>,
313 detail::negation<detail::disjunction<detail::is_alike<T, bson_value::view>,
314 detail::is_alike<T, bson_value::value>>>>;
316 template <
typename T>
317 using not_view = is_bson_view_compatible<T>;
319 template <
typename T>
320 BSONCXX_INLINE detail::requires_t<bool, is_bson_view_compatible<T>>
325 template <
typename T>
326 BSONCXX_INLINE detail::requires_t<bool, is_bson_view_compatible<T>>
327 operator==(T&& lhs,
const bson_value::view& rhs) {
328 return bson_value::view{std::forward<T>(lhs)} == rhs;
331 template <
typename T>
332 BSONCXX_INLINE detail::requires_t<bool, is_bson_view_compatible<T>>
333 operator!=(
const bson_value::view& lhs, T&& rhs) {
334 return lhs != bson_value::view{std::forward<T>(rhs)};
337 template <
typename T>
338 BSONCXX_INLINE detail::requires_t<bool, is_bson_view_compatible<T>>
339 operator!=(T&& lhs,
const bson_value::view& rhs) {
340 return bson_value::view{std::forward<T>(lhs)} != rhs;
349 #include <bsoncxx/config/postlude.hpp>
A variant owning type that represents any BSON type.
Definition: value.hpp:43
A view-only variant that can contain any BSON type.
Definition: view.hpp:44
view() noexcept
Default constructs a bson_value::view.
type
An enumeration of each BSON type.
Definition: types.hpp:50
The top-level namespace for bsoncxx library entities.
Definition: element.hpp:24
A BSON array value.
Definition: types.hpp:199
A BSON binary data value.
Definition: types.hpp:224
A BSON boolean value.
Definition: types.hpp:282
A BSON JavaScript code value.
Definition: types.hpp:438
A BSON JavaScript code with scope value.
Definition: types.hpp:509
A BSON date value.
Definition: types.hpp:307
A BSON DBPointer value.
Definition: types.hpp:419
A BSON Decimal128 value.
Definition: types.hpp:612
A BSON document value.
Definition: types.hpp:167
A BSON double value.
Definition: types.hpp:101
A BSON signed 32-bit integer value.
Definition: types.hpp:543
A BSON 64-bit signed integer value.
Definition: types.hpp:587
A BSON max-key value.
Definition: types.hpp:655
A BSON min-key value.
Definition: types.hpp:639
A BSON null value.
Definition: types.hpp:366
A BSON ObjectId value.
Definition: types.hpp:264
A BSON regex value.
Definition: types.hpp:382
A BSON UTF-8 encoded string value.
Definition: types.hpp:126
A BSON Symbol value.
Definition: types.hpp:475
A BSON replication timestamp value.
Definition: types.hpp:568
A BSON undefined value.
Definition: types.hpp:248