19 #include <type_traits>
21 #include <bsoncxx/document/element-fwd.hpp>
22 #include <bsoncxx/types/bson_value/value-fwd.hpp>
23 #include <bsoncxx/types/bson_value/view-fwd.hpp>
25 #include <bsoncxx/stdx/type_traits.hpp>
26 #include <bsoncxx/types.hpp>
28 #include <bsoncxx/config/prelude.hpp>
33 namespace bson_value {
57 #define BSONCXX_ENUM(type, val) explicit view(b_##type) noexcept;
58 #include <bsoncxx/enums/type.hpp>
68 view& operator=(const
view&) noexcept;
79 friend BSONCXX_API
bool BSONCXX_CALL operator==(const bson_value::
view&,
80 const bson_value::
view&);
81 friend BSONCXX_API
bool BSONCXX_CALL operator!=(const bson_value::
view&,
82 const bson_value::
view&);
272 friend ::
bsoncxx::v_noabi::document::element;
274 view(const std::uint8_t* raw, std::uint32_t length, std::uint32_t offset, std::uint32_t keylen);
275 view(
void* internal_value) noexcept;
277 void _init(
void* internal_value) noexcept;
279 void BSONCXX_PRIVATE destroy() noexcept;
308 template <
typename T>
309 using is_bson_view_compatible = detail::conjunction<
310 std::is_constructible<bson_value::view, T>,
311 detail::negation<detail::disjunction<detail::is_alike<T, bson_value::view>,
312 detail::is_alike<T, bson_value::value>>>>;
314 template <
typename T>
315 using not_view = is_bson_view_compatible<T>;
317 template <
typename T>
318 BSONCXX_INLINE detail::requires_t<bool, is_bson_view_compatible<T>>
323 template <
typename T>
324 BSONCXX_INLINE detail::requires_t<bool, is_bson_view_compatible<T>>
325 operator==(T&& lhs,
const bson_value::view& rhs) {
326 return bson_value::view{std::forward<T>(lhs)} == rhs;
329 template <
typename T>
330 BSONCXX_INLINE detail::requires_t<bool, is_bson_view_compatible<T>>
331 operator!=(
const bson_value::view& lhs, T&& rhs) {
332 return lhs != bson_value::view{std::forward<T>(rhs)};
335 template <
typename T>
336 BSONCXX_INLINE detail::requires_t<bool, is_bson_view_compatible<T>>
337 operator!=(T&& lhs,
const bson_value::view& rhs) {
338 return bson_value::view{std::forward<T>(lhs)} != rhs;
348 namespace bson_value {
350 using ::bsoncxx::v_noabi::types::bson_value::operator==;
351 using ::bsoncxx::v_noabi::types::bson_value::operator!=;
357 #include <bsoncxx/config/postlude.hpp>
A variant owning type that represents any BSON type.
Definition: value.hpp:46
A view-only variant that can contain any BSON type.
Definition: view.hpp:41
const b_symbol & get_symbol() const
const b_double & get_double() const
const b_minkey & get_minkey() const
const b_int32 & get_int32() const
const b_int64 & get_int64() const
const b_array & get_array() const
const b_regex & get_regex() const
const b_dbpointer & get_dbpointer() const
const b_string & get_utf8() const
const b_decimal128 & get_decimal128() const
const b_string & get_string() const
const b_null & get_null() const
const b_code & get_code() const
const b_binary & get_binary() const
const b_maxkey & get_maxkey() const
const b_oid & get_oid() const
view() noexcept
Default constructs a bson_value::view.
const b_codewscope & get_codewscope() const
const b_date & get_date() const
const b_bool & get_bool() const
const b_timestamp & get_timestamp() const
const b_undefined & get_undefined() const
const b_document & get_document() const
type
An enumeration of each BSON type.
Definition: types.hpp:48
The top-level namespace for bsoncxx library entities.
Definition: element-fwd.hpp:19
A BSON array value.
Definition: types.hpp:197
A BSON binary data value.
Definition: types.hpp:222
A BSON boolean value.
Definition: types.hpp:280
A BSON JavaScript code value.
Definition: types.hpp:436
A BSON JavaScript code with scope value.
Definition: types.hpp:507
A BSON date value.
Definition: types.hpp:305
A BSON DBPointer value.
Definition: types.hpp:417
A BSON Decimal128 value.
Definition: types.hpp:610
A BSON document value.
Definition: types.hpp:165
A BSON double value.
Definition: types.hpp:99
A BSON signed 32-bit integer value.
Definition: types.hpp:541
A BSON 64-bit signed integer value.
Definition: types.hpp:585
A BSON max-key value.
Definition: types.hpp:653
A BSON min-key value.
Definition: types.hpp:637
A BSON null value.
Definition: types.hpp:364
A BSON ObjectId value.
Definition: types.hpp:262
A BSON regex value.
Definition: types.hpp:380
A BSON UTF-8 encoded string value.
Definition: types.hpp:124
A BSON Symbol value.
Definition: types.hpp:473
A BSON replication timestamp value.
Definition: types.hpp:566
A BSON undefined value.
Definition: types.hpp:246