MongoDB C++ Driver 4.4.0
Loading...
Searching...
No Matches
view.hpp
Go to the documentation of this file.
1// Copyright 2009-present MongoDB, Inc.
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15#pragma once
16
17#include <bsoncxx/v1/types/view-fwd.hpp> // IWYU pragma: export
18
19//
20
22
23#include <bsoncxx/v1/array/view.hpp> // IWYU pragma: export
25#include <bsoncxx/v1/decimal128.hpp> // IWYU pragma: export
28#include <bsoncxx/v1/document/view.hpp> // IWYU pragma: export
29#include <bsoncxx/v1/oid.hpp> // IWYU pragma: export
31#include <bsoncxx/v1/types/id.hpp> // IWYU pragma: export
32
33#include <chrono>
34#include <cstdint>
35#include <cstring>
36#include <system_error>
37#include <type_traits>
38
39namespace bsoncxx {
40namespace v1 {
41namespace types {
42
43// BSONCXX_V1_TYPES_XMACRO: update below.
44
48struct b_double {
52 static constexpr id type_id = id::k_double;
53
57 double value = {};
58
62 b_double() = default;
63
67 explicit b_double(double value) : value{value} {}
68
72 /* explicit(false) */ operator double() const {
73 return value;
74 }
75
79 friend bool operator==(b_double const& lhs, b_double const& rhs) {
80 BSONCXX_PRIVATE_WARNINGS_PUSH();
81 BSONCXX_PRIVATE_WARNINGS_DISABLE(GNU("-Wfloat-equal"));
82 return lhs.value == rhs.value;
83 BSONCXX_PRIVATE_WARNINGS_POP();
84 }
85
89 friend bool operator!=(b_double const& lhs, b_double const& rhs) {
90 return !(lhs == rhs);
91 }
92};
93
97struct b_string {
101 static constexpr id type_id = id::k_string;
102
107
111 b_string() = default;
112
117
121 /* explicit(false) */ operator v1::stdx::string_view() const {
122 return value;
123 }
124
128 friend bool operator==(b_string const& lhs, b_string const& rhs) {
129 return lhs.value == rhs.value;
130 }
131
135 friend bool operator!=(b_string const& lhs, b_string const& rhs) {
136 return !(lhs == rhs);
137 }
138};
139
147 static constexpr id type_id = id::k_document;
148
153
157 b_document() = default;
158
163
167 /* explicit(false) */ operator v1::document::view() const {
168 return value;
169 }
170
172 return value;
173 }
174
178 friend bool operator==(b_document const& lhs, b_document const& rhs) {
179 return lhs.value == rhs.value;
180 }
181
185 friend bool operator!=(b_document const& lhs, b_document const& rhs) {
186 return !(lhs == rhs);
187 }
188};
189
193struct b_array {
197 static constexpr id type_id = id::k_array;
198
203
207 b_array() = default;
208
213
217 /* explicit(false) */ operator v1::array::view() const {
218 return value;
219 }
220
224 friend bool operator==(b_array const& lhs, b_array const& rhs) {
225 return lhs.value == rhs.value;
226 }
227
231 friend bool operator!=(b_array const& lhs, b_array const& rhs) {
232 return !(lhs == rhs);
233 }
234};
235
239struct b_binary {
243 static constexpr id type_id = id::k_binary;
244
249
253 std::uint32_t size = {};
254
258 std::uint8_t const* bytes = {};
259
263 b_binary() = default;
264
268 b_binary(binary_subtype subtype, std::uint32_t size, std::uint8_t const* bytes)
270
278 friend bool operator==(b_binary const& lhs, b_binary const& rhs) {
279 if (lhs.size != rhs.size) {
280 return false;
281 }
282
283 if (!lhs.bytes != !rhs.bytes) {
284 return false;
285 }
286
287 if (!lhs.bytes || lhs.size == 0u) {
288 return true; // Empty.
289 }
290
291 return lhs.subtype == rhs.subtype && (std::memcmp(lhs.bytes, rhs.bytes, lhs.size) == 0);
292 }
293
294 friend bool operator!=(b_binary const& lhs, b_binary const& rhs) {
295 return !(lhs == rhs);
296 }
297
299};
300
310 static constexpr id type_id = id::k_undefined;
311
315 friend bool operator==(b_undefined const&, b_undefined const&) {
316 return true;
317 }
318
322 friend bool operator!=(b_undefined const& lhs, b_undefined const& rhs) {
323 return !(lhs == rhs);
324 }
325};
326
330struct b_oid {
334 static constexpr id type_id = id::k_oid;
335
340
344 b_oid() = default;
345
349 explicit b_oid(v1::oid const& value) : value{value} {}
350
354 /* explicit(false) */ operator v1::oid() const {
355 return value;
356 }
357
361 friend bool operator==(b_oid const& lhs, b_oid const& rhs) {
362 return lhs.value == rhs.value;
363 }
364
368 friend bool operator!=(b_oid const& lhs, b_oid const& rhs) {
369 return !(lhs == rhs);
370 }
371};
372
376struct b_bool {
380 static constexpr id type_id = id::k_bool;
381
385 bool value = false;
386
390 b_bool() = default;
391
395 explicit b_bool(bool value) : value{value} {}
396
400 /* explicit(false) */ operator bool() const {
401 return value;
402 }
403
407 friend bool operator==(b_bool const& lhs, b_bool const& rhs) {
408 return lhs.value == rhs.value;
409 }
410
414 friend bool operator!=(b_bool const& lhs, b_bool const& rhs) {
415 return !(lhs == rhs);
416 }
417};
418
422struct b_date {
426 static constexpr id type_id = id::k_date;
427
431 std::chrono::milliseconds value = {};
432
436 b_date() = default;
437
441 explicit b_date(std::chrono::milliseconds value) : value{value} {}
442
446 explicit b_date(std::chrono::system_clock::time_point tp)
447 : value{std::chrono::duration_cast<std::chrono::milliseconds>(tp.time_since_epoch())} {}
448
452 /* explicit(false) */ operator std::chrono::milliseconds() const {
453 return value;
454 }
455
456 explicit operator std::chrono::system_clock::time_point() const {
457 return std::chrono::system_clock::time_point(
458 std::chrono::duration_cast<std::chrono::system_clock::duration>(value));
459 }
460
464 friend bool operator==(b_date const& lhs, b_date const& rhs) {
465 return lhs.value == rhs.value;
466 }
467
471 friend bool operator!=(b_date const& lhs, b_date const& rhs) {
472 return !(lhs == rhs);
473 }
474};
475
479struct b_null {
483 static constexpr id type_id = id::k_null;
484
488 friend bool operator==(b_null const& /* lhs */, b_null const& /* rhs */) {
489 return true;
490 }
491
495 friend bool operator!=(b_null const& lhs, b_null const& rhs) {
496 return !(lhs == rhs);
497 }
498};
499
503struct b_regex {
507 static constexpr id type_id = id::k_regex;
508
513
518
522 b_regex() = default;
523
528
533
537 friend bool operator==(b_regex const& lhs, b_regex const& rhs) {
538 return lhs.regex == rhs.regex && lhs.options == rhs.options;
539 }
540
544 friend bool operator!=(b_regex const& lhs, b_regex const& rhs) {
545 return !(lhs == rhs);
546 }
547};
548
558 static constexpr id type_id = id::k_dbpointer;
559
564
569
573 b_dbpointer() = default;
574
579
583 friend bool operator==(b_dbpointer const& lhs, b_dbpointer const& rhs) {
584 return lhs.collection == rhs.collection && lhs.value == rhs.value;
585 }
586
590 friend bool operator!=(b_dbpointer const& lhs, b_dbpointer const& rhs) {
591 return !(lhs == rhs);
592 }
593};
594
598struct b_code {
602 static constexpr id type_id = id::k_code;
603
608
612 b_code() = default;
613
618
622 /* explicit(false) */ operator v1::stdx::string_view() const {
623 return code;
624 }
625
629 friend bool operator==(b_code const& lhs, b_code const& rhs) {
630 return lhs.code == rhs.code;
631 }
632
636 friend bool operator!=(b_code const& lhs, b_code const& rhs) {
637 return !(lhs == rhs);
638 }
639};
640
646struct b_symbol {
650 static constexpr id type_id = id::k_symbol;
651
656
660 b_symbol() = default;
661
666
670 /* explicit(false) */ operator v1::stdx::string_view() const {
671 return symbol;
672 }
673
677 friend bool operator==(b_symbol const& lhs, b_symbol const& rhs) {
678 return lhs.symbol == rhs.symbol;
679 }
680
684 friend bool operator!=(b_symbol const& lhs, b_symbol const& rhs) {
685 return !(lhs == rhs);
686 }
687};
688
698 static constexpr id type_id = id::k_codewscope;
699
704
709
713 b_codewscope() = default;
714
719
723 friend bool operator==(b_codewscope const& lhs, b_codewscope const& rhs) {
724 return lhs.code == rhs.code && lhs.scope == rhs.scope;
725 }
726
730 friend bool operator!=(b_codewscope const& lhs, b_codewscope const& rhs) {
731 return !(lhs == rhs);
732 }
733};
734
738struct b_int32 {
742 static constexpr id type_id = id::k_int32;
743
747 std::int32_t value = {};
748
752 b_int32() = default;
753
757 explicit b_int32(std::int32_t value) : value{value} {}
758
762 /* explicit(false) */ operator std::int32_t() const {
763 return value;
764 }
765
769 friend bool operator==(b_int32 const& lhs, b_int32 const& rhs) {
770 return lhs.value == rhs.value;
771 }
772
776 friend bool operator!=(b_int32 const& lhs, b_int32 const& rhs) {
777 return !(lhs == rhs);
778 }
779};
780
788 static constexpr id type_id = id::k_timestamp;
789
793 std::uint32_t increment = {};
794
798 std::uint32_t timestamp = {};
799
803 b_timestamp() = default;
804
809
813 friend bool operator==(b_timestamp const& lhs, b_timestamp const& rhs) {
814 return lhs.timestamp == rhs.timestamp;
815 }
816
820 friend bool operator!=(b_timestamp const& lhs, b_timestamp const& rhs) {
821 return !(lhs == rhs);
822 }
823};
824
828struct b_int64 {
832 static constexpr id type_id = id::k_int64;
833
837 std::int64_t value = {};
838
842 b_int64() = default;
843
847 explicit b_int64(std::int64_t value) : value{value} {}
848
852 /* explicit(false) */ operator std::int64_t() const {
853 return value;
854 }
855
859 friend bool operator==(b_int64 const& lhs, b_int64 const& rhs) {
860 return lhs.value == rhs.value;
861 }
862
866 friend bool operator!=(b_int64 const& lhs, b_int64 const& rhs) {
867 return !(lhs == rhs);
868 }
869};
870
878 static constexpr id type_id = id::k_decimal128;
879
884
888 b_decimal128() = default;
889
894
898 /* explicit(false) */ operator v1::decimal128() const {
899 return value;
900 }
901
905 friend bool operator==(b_decimal128 const& lhs, b_decimal128 const& rhs) {
906 return lhs.value == rhs.value;
907 }
908
912 friend bool operator!=(b_decimal128 const& lhs, b_decimal128 const& rhs) {
913 return !(lhs == rhs);
914 }
915};
916
920struct b_maxkey {
924 static constexpr id type_id = id::k_maxkey;
925
929 friend bool operator==(b_maxkey const&, b_maxkey const&) {
930 return true;
931 }
932
936 friend bool operator!=(b_maxkey const& lhs, b_maxkey const& rhs) {
937 return !(lhs == rhs);
938 }
939};
940
944struct b_minkey {
948 static constexpr id type_id = id::k_minkey;
949
953 friend bool operator==(b_minkey const&, b_minkey const&) {
954 return true;
955 }
956
960 friend bool operator!=(b_minkey const& lhs, b_minkey const& rhs) {
961 return !(lhs == rhs);
962 }
963};
964
965// BSONCXX_V1_TYPES_XMACRO: update above.
966
967#pragma push_macro("X")
968#undef X
969#define X(_name, _val) BSONCXX_PRIVATE_INLINE_CXX17 constexpr id b_##_name::type_id;
971#pragma pop_macro("X")
972
979class view {
980 private:
981 id _id;
982
983#pragma push_macro("X")
984#undef X
985#define X(_name, _value) b_##_name _b_##_name;
986
987 union {
989 };
990#pragma pop_macro("X")
991
992 template <typename T>
993 using is_view = detail::is_alike<T, view>;
994
995 template <typename T>
996 struct is_equality_comparable_with
997 : detail::conjunction<detail::negation<is_view<T>>, std::is_constructible<view, T>> {};
998
999 public:
1001 view() : _id{id::k_null}, _b_null{} {}
1002
1003#pragma push_macro("X")
1004#undef X
1005#define X(_name, _value) \
1006 /* explicit(false) */ view(b_##_name v) : _id{v.type_id}, _b_##_name{v} {}
1007
1015#pragma pop_macro("X")
1016
1020 id type_id() const {
1021 return _id;
1022 }
1023
1024#pragma push_macro("X")
1025#undef X
1026#define X(_name, _value) BSONCXX_ABI_EXPORT_CDECL(b_##_name) get_##_name() const;
1027
1038#pragma pop_macro("X")
1039
1053 friend bool operator==(view const& lhs, view const& rhs) {
1054 if (lhs.type_id() != rhs.type_id()) {
1055 return false;
1056 }
1057
1058#pragma push_macro("X")
1059#undef X
1060#define X(_name, _value) \
1061 case v1::types::id::k_##_name: \
1062 return lhs.get_##_name() == rhs.get_##_name();
1063
1064 switch (lhs.type_id()) {
1066
1067 default:
1068 return true;
1069 }
1070#pragma pop_macro("X")
1071 }
1072
1076 friend bool operator!=(view const& lhs, view const& rhs) {
1077 return !(lhs == rhs);
1078 }
1079
1084 friend bool operator==(view const& v, v1::element::view const& e) {
1085 return v == e.type_view();
1086 }
1087
1088 friend bool operator==(v1::element::view const& e, view const& v) {
1089 return v == e.type_view();
1090 }
1091
1093
1098 friend bool operator!=(view const& v, v1::element::view const& e) {
1099 return !(v == e);
1100 }
1101
1102 friend bool operator!=(v1::element::view const& e, view const& v) {
1103 return !(v == e);
1104 }
1105
1107
1116 template <typename T, detail::enable_if_t<is_equality_comparable_with<T>::value>* = nullptr>
1117 friend bool operator==(view const& v, T const& value) {
1118 return v == view{value};
1119 }
1120
1121 template <typename T, detail::enable_if_t<is_equality_comparable_with<T>::value>* = nullptr>
1122 friend bool operator==(T const& value, view const& v) {
1123 return v == view{value};
1124 }
1125
1127
1132 template <typename T, detail::enable_if_t<is_equality_comparable_with<T>::value>* = nullptr>
1133 friend bool operator!=(view const& v, T const& value) {
1134 return !(v == value);
1135 }
1136
1137 template <typename T, detail::enable_if_t<is_equality_comparable_with<T>::value>* = nullptr>
1138 friend bool operator!=(T const& value, view const& v) {
1139 return !(v == value);
1140 }
1141
1143
1147 enum class errc {
1150 };
1151
1155 static BSONCXX_ABI_EXPORT_CDECL(std::error_category const&) error_category();
1156
1160 friend std::error_code make_error_code(errc v) {
1161 return {static_cast<int>(v), error_category()};
1162 }
1163
1164 class internal;
1165};
1166
1167} // namespace types
1168} // namespace v1
1169} // namespace bsoncxx
1170
1171template <>
1172struct std::is_error_code_enum<bsoncxx::v1::types::view::errc> : true_type {};
1173
1175
Provides macros to control the set of symbols exported in the ABI.
#define BSONCXX_ABI_EXPORT_CDECL(...)
Equivalent to BSONCXX_ABI_EXPORT with BSONCXX_ABI_CDECL.
Definition export.hpp:52
For internal use only!
The bsoncxx v1 macro guard postlude header.
The bsoncxx v1 macro guard prelude header.
A non-owning, read-only BSON array.
Definition view.hpp:47
A BSON Decimal128.
Definition decimal128.hpp:37
A non-owning, read-only BSON document.
Definition view.hpp:52
A non-owning, read-only BSON element.
Definition view.hpp:82
v1::types::view type_view() const
Return a view of the underlying BSON type value.
A BSON ObjectID.
Definition oid.hpp:41
A polyfill for std::string_view.
Definition string_view.hpp:412
A union of BSON type values.
Definition value.hpp:52
id type_id() const
Return the type of the underlying BSON type value.
Definition view.hpp:1020
friend bool operator!=(v1::element::view const &e, view const &v)
Equivalent to !(v == e).
Definition view.hpp:1102
friend bool operator==(view const &v, v1::element::view const &e)
Equivalent to v == e.type_view().
Definition view.hpp:1084
friend bool operator==(view const &v, T const &value)
Equivalent to v == bsoncxx::v1::types::view{value}.
Definition view.hpp:1117
friend bool operator!=(view const &v, T const &value)
Equivalent to !(v == value).
Definition view.hpp:1133
friend bool operator!=(T const &value, view const &v)
Equivalent to !(v == value).
Definition view.hpp:1138
friend bool operator==(view const &lhs, view const &rhs)
Compare equal when the underlying BSON type values have the same type and compare equal.
Definition view.hpp:1053
friend std::error_code make_error_code(errc v)
Support implicit conversion to std::error_code.
Definition view.hpp:1160
view()
Initialize with bsoncxx::v1::types::b_null.
Definition view.hpp:1001
static std::error_category const & error_category()
The error category for bsoncxx::v1::types::view::errc.
friend bool operator!=(view const &lhs, view const &rhs)
Equivalent to !(lhs == rhs).
Definition view.hpp:1076
friend bool operator==(T const &value, view const &v)
Equivalent to v == bsoncxx::v1::types::view{value}.
Definition view.hpp:1122
errc
Errors codes which may be returned by bsoncxx::v1::types::view.
Definition view.hpp:1147
@ type_mismatch
Requested type does not match the underlying type.
Definition view.hpp:1149
@ zero
Zero.
Definition view.hpp:1148
friend bool operator!=(view const &v, v1::element::view const &e)
Equivalent to !(v == e).
Definition view.hpp:1098
friend bool operator==(v1::element::view const &e, view const &v)
Equivalent to v == e.type_view().
Definition view.hpp:1088
Declares entities representing a BSON type value.
binary_subtype
Enumeration identifying a BSON binary subtype.
Definition id.hpp:71
id
Enumeration identifying a BSON type.
Definition id.hpp:37
@ k_decimal128
128-bit decimal floating point.
Definition id.hpp:57
@ k_minkey
Min key.
Definition id.hpp:38
@ k_double
64-bit binary floating point.
Definition id.hpp:39
@ k_dbpointer
DBPointer.
Definition id.hpp:50
@ k_int64
64-bit integer.
Definition id.hpp:56
@ k_codewscope
JavaScript code with scope.
Definition id.hpp:53
@ k_regex
Regular expression.
Definition id.hpp:49
@ k_string
UTF-8 string.
Definition id.hpp:40
@ k_array
Array.
Definition id.hpp:42
@ k_bool
Boolean.
Definition id.hpp:46
@ k_symbol
Symbol.
Definition id.hpp:52
@ k_oid
ObjectId.
Definition id.hpp:45
@ k_date
UTC datetime.
Definition id.hpp:47
@ k_int32
32-bit integer.
Definition id.hpp:54
@ k_timestamp
Timestamp.
Definition id.hpp:55
@ k_undefined
Undefined value.
Definition id.hpp:44
@ k_code
JavaScript code.
Definition id.hpp:51
@ k_document
Embedded document.
Definition id.hpp:41
@ k_maxkey
Max key.
Definition id.hpp:58
@ k_binary
Binary data.
Definition id.hpp:43
@ k_null
Null value.
Definition id.hpp:48
Declares entities whose ABI stability is guaranteed for documented symbols.
The top-level namespace within which all bsoncxx library entities are declared.
b_array()=default
Zero-initialize the represented value.
friend bool operator==(b_array const &lhs, b_array const &rhs)
Equivalent to lhs.value == rhs.value.
Definition view.hpp:224
friend bool operator!=(b_array const &lhs, b_array const &rhs)
Equivalent to !(lhs == rhs).
Definition view.hpp:231
v1::array::view value
The represented value.
Definition view.hpp:202
static constexpr id type_id
The type represented by this BSON type value.
Definition view.hpp:197
b_array(v1::array::view value)
Initialize with value.
Definition view.hpp:212
friend bool operator==(b_binary const &lhs, b_binary const &rhs)
Compare equal when the binary subtype and pointed-to bytes compare equal.
Definition view.hpp:278
b_binary(binary_subtype subtype, std::uint32_t size, std::uint8_t const *bytes)
Initialize with the given binary subtype and pointer to binary data.
Definition view.hpp:268
b_binary()=default
Zero-initialize the represented value.
static constexpr id type_id
The type represented by this BSON type value.
Definition view.hpp:243
friend bool operator!=(b_binary const &lhs, b_binary const &rhs)
Compare equal when the binary subtype and pointed-to bytes compare equal.
Definition view.hpp:294
binary_subtype subtype
The represented value's binary subtype component.
Definition view.hpp:248
std::uint8_t const * bytes
The represented value's binary data.
Definition view.hpp:258
std::uint32_t size
The represented value's length of binary data.
Definition view.hpp:253
b_bool(bool value)
Initialize with value.
Definition view.hpp:395
bool value
The represented value.
Definition view.hpp:385
friend bool operator!=(b_bool const &lhs, b_bool const &rhs)
Equivalent to !(lhs == rhs).
Definition view.hpp:414
static constexpr id type_id
The type represented by this BSON type value.
Definition view.hpp:380
friend bool operator==(b_bool const &lhs, b_bool const &rhs)
Equivalent to lhs.value == rhs.value.
Definition view.hpp:407
b_bool()=default
Zero-initialize the represented value.
static constexpr id type_id
The type represented by this BSON type value.
Definition view.hpp:602
friend bool operator!=(b_code const &lhs, b_code const &rhs)
Equivalent to !(lhs == rhs).
Definition view.hpp:636
v1::stdx::string_view code
The represented value.
Definition view.hpp:607
friend bool operator==(b_code const &lhs, b_code const &rhs)
Equivalent to lhs.code == rhs.code.
Definition view.hpp:629
b_code()=default
Zero-initialize the represented value.
b_code(v1::stdx::string_view code)
Initialize with code.
Definition view.hpp:617
v1::document::view scope
The represented value's "$scope" component.
Definition view.hpp:708
b_codewscope()=default
Zero-initialize the represented value.
friend bool operator==(b_codewscope const &lhs, b_codewscope const &rhs)
Equivalent to lhs.code == rhs.code && lhs.scope == rhs.scope.
Definition view.hpp:723
static constexpr id type_id
The type represented by this BSON type value.
Definition view.hpp:698
friend bool operator!=(b_codewscope const &lhs, b_codewscope const &rhs)
Equivalent to !(lhs == rhs).
Definition view.hpp:730
b_codewscope(v1::stdx::string_view code, v1::document::view scope)
Initialize with code and scope.
Definition view.hpp:718
v1::stdx::string_view code
The represented value's "$code" component.
Definition view.hpp:703
std::chrono::milliseconds value
The represented value (milliseconds relative to the Unix epoch).
Definition view.hpp:431
friend bool operator==(b_date const &lhs, b_date const &rhs)
Equivalent to lhs.value == rhs.value.
Definition view.hpp:464
friend bool operator!=(b_date const &lhs, b_date const &rhs)
Equivalent to !(lhs == rhs).
Definition view.hpp:471
static constexpr id type_id
The type represented by this BSON type value.
Definition view.hpp:426
b_date()=default
Zero-initialize the represented value.
b_date(std::chrono::milliseconds value)
Initialize with value (milliseconds relative to the Unix epoch).
Definition view.hpp:441
b_date(std::chrono::system_clock::time_point tp)
Initialize with tp (assuming the epoch of std::chrono::system_clock is the Unix epoch).
Definition view.hpp:446
friend bool operator==(b_dbpointer const &lhs, b_dbpointer const &rhs)
Equivalent to lhs.collection == rhs.collection && lhs.value == rhs.value.
Definition view.hpp:583
b_dbpointer(v1::stdx::string_view collection, v1::oid value)
Initialize with collection and value.
Definition view.hpp:578
friend bool operator!=(b_dbpointer const &lhs, b_dbpointer const &rhs)
Equivalent to !(lhs == rhs).
Definition view.hpp:590
static constexpr id type_id
The type represented by this BSON type value.
Definition view.hpp:558
b_dbpointer()=default
Zero-initialize the represented value.
v1::oid value
The represented value's "$id" (ObjectID) component.
Definition view.hpp:568
v1::stdx::string_view collection
The represented value's "$ref" (namespace) component.
Definition view.hpp:563
friend bool operator!=(b_decimal128 const &lhs, b_decimal128 const &rhs)
Equivalent to !(lhs == rhs).
Definition view.hpp:912
b_decimal128()=default
Zero-initialize the represented value.
friend bool operator==(b_decimal128 const &lhs, b_decimal128 const &rhs)
Equivalent to lhs.value == rhs.value.
Definition view.hpp:905
static constexpr id type_id
The type represented by this BSON type value.
Definition view.hpp:878
b_decimal128(v1::decimal128 value)
Initialize with value.
Definition view.hpp:893
v1::decimal128 value
The represented value.
Definition view.hpp:883
friend bool operator==(b_document const &lhs, b_document const &rhs)
Equivalent to lhs.value == rhs.value.
Definition view.hpp:178
operator v1::document::view() const
Implicitly convert to value.
Definition view.hpp:167
static constexpr id type_id
The type represented by this BSON type value.
Definition view.hpp:147
v1::document::view value
The represented value.
Definition view.hpp:152
friend bool operator!=(b_document const &lhs, b_document const &rhs)
Equivalent to !(lhs == rhs).
Definition view.hpp:185
b_document()=default
Zero-initialize the represented value.
b_document(v1::document::view value)
Initialize with value.
Definition view.hpp:162
b_double(double value)
Initialize with value.
Definition view.hpp:67
friend bool operator!=(b_double const &lhs, b_double const &rhs)
Equivalent to !(lhs == rhs).
Definition view.hpp:89
double value
The represented value.
Definition view.hpp:57
friend bool operator==(b_double const &lhs, b_double const &rhs)
Equivalent to lhs.value == rhs.value.
Definition view.hpp:79
b_double()=default
Zero-initialize the represented value.
static constexpr id type_id
The type represented by this BSON type value.
Definition view.hpp:52
friend bool operator==(b_int32 const &lhs, b_int32 const &rhs)
Equivalent to lhs.value == rhs.value.
Definition view.hpp:769
b_int32()=default
Zero-initialize the represented value.
static constexpr id type_id
The type represented by this BSON type value.
Definition view.hpp:742
std::int32_t value
The represented value.
Definition view.hpp:747
friend bool operator!=(b_int32 const &lhs, b_int32 const &rhs)
Equivalent to !(lhs == rhs).
Definition view.hpp:776
b_int32(std::int32_t value)
Initialize with value.
Definition view.hpp:757
static constexpr id type_id
The type represented by this BSON type value.
Definition view.hpp:832
friend bool operator!=(b_int64 const &lhs, b_int64 const &rhs)
Equivalent to !(lhs == rhs).
Definition view.hpp:866
friend bool operator==(b_int64 const &lhs, b_int64 const &rhs)
Equivalent to lhs.value == rhs.value.
Definition view.hpp:859
b_int64(std::int64_t value)
Initialize with value.
Definition view.hpp:847
b_int64()=default
Zero-initialize the represented value.
std::int64_t value
The represented value.
Definition view.hpp:837
BSON type value "Max Key".
Definition view.hpp:920
friend bool operator!=(b_maxkey const &lhs, b_maxkey const &rhs)
Return false.
Definition view.hpp:936
static constexpr id type_id
The type represented by this BSON type value.
Definition view.hpp:924
friend bool operator==(b_maxkey const &, b_maxkey const &)
Return true.
Definition view.hpp:929
BSON type value "Min Key".
Definition view.hpp:944
static constexpr id type_id
The type represented by this BSON type value.
Definition view.hpp:948
friend bool operator==(b_minkey const &, b_minkey const &)
Return true.
Definition view.hpp:953
friend bool operator!=(b_minkey const &lhs, b_minkey const &rhs)
Return false.
Definition view.hpp:960
BSON type value "Null Value".
Definition view.hpp:479
friend bool operator==(b_null const &, b_null const &)
Return true.
Definition view.hpp:488
static constexpr id type_id
The type represented by this BSON type value.
Definition view.hpp:483
friend bool operator!=(b_null const &lhs, b_null const &rhs)
Return false.
Definition view.hpp:495
v1::oid value
The represented value.
Definition view.hpp:339
b_oid()=default
Zero-initialize the represented value.
b_oid(v1::oid const &value)
Initialize with value.
Definition view.hpp:349
friend bool operator==(b_oid const &lhs, b_oid const &rhs)
Equivalent to lhs.value == rhs.value.
Definition view.hpp:361
friend bool operator!=(b_oid const &lhs, b_oid const &rhs)
Equivalent to !(lhs == rhs).
Definition view.hpp:368
static constexpr id type_id
The type represented by this BSON type value.
Definition view.hpp:334
b_regex(v1::stdx::string_view regex, v1::stdx::string_view options)
Initialize with regex and options.
Definition view.hpp:532
static constexpr id type_id
The type represented by this BSON type value.
Definition view.hpp:507
v1::stdx::string_view regex
The represented value's "pattern" component.
Definition view.hpp:512
b_regex(v1::stdx::string_view regex)
Initialize with regex and an empty options.
Definition view.hpp:527
friend bool operator!=(b_regex const &lhs, b_regex const &rhs)
Equivalent to !(lhs == rhs).
Definition view.hpp:544
b_regex()=default
Zero-initialize the represented value.
v1::stdx::string_view options
The represented value's "options" component.
Definition view.hpp:517
friend bool operator==(b_regex const &lhs, b_regex const &rhs)
Equivalent to lhs.regex == rhs.regex && lhs.options == rhs.options.
Definition view.hpp:537
friend bool operator==(b_string const &lhs, b_string const &rhs)
Equivalent to lhs.value == rhs.value.
Definition view.hpp:128
b_string(v1::stdx::string_view value)
Initialize with value.
Definition view.hpp:116
v1::stdx::string_view value
The represented value.
Definition view.hpp:106
b_string()=default
Zero-initialize the represented value.
friend bool operator!=(b_string const &lhs, b_string const &rhs)
Equivalent to !(lhs == rhs).
Definition view.hpp:135
static constexpr id type_id
The type represented by this BSON type value.
Definition view.hpp:101
v1::stdx::string_view symbol
The represented value.
Definition view.hpp:655
b_symbol(v1::stdx::string_view symbol)
Initialize with symbol.
Definition view.hpp:665
friend bool operator==(b_symbol const &lhs, b_symbol const &rhs)
Equivalent to lhs.symbol == rhs.symbol.
Definition view.hpp:677
static constexpr id type_id
The type represented by this BSON type value.
Definition view.hpp:650
friend bool operator!=(b_symbol const &lhs, b_symbol const &rhs)
Equivalent to !(lhs == rhs).
Definition view.hpp:684
b_symbol()=default
Zero-initialize the represented value.
std::uint32_t increment
The represented value's "i" component.
Definition view.hpp:793
b_timestamp()=default
Zero-initialize the represented value.
friend bool operator==(b_timestamp const &lhs, b_timestamp const &rhs)
Equivalent to lhs.timestamp == rhs.timestamp.
Definition view.hpp:813
static constexpr id type_id
The type represented by this BSON type value.
Definition view.hpp:788
b_timestamp(std::uint32_t increment, std::uint32_t timestamp)
Initialize with increment and timestamp.
Definition view.hpp:808
std::uint32_t timestamp
The represented value's "t" component.
Definition view.hpp:798
friend bool operator!=(b_timestamp const &lhs, b_timestamp const &rhs)
Equivalent to !(lhs == rhs).
Definition view.hpp:820
BSON type value "Undefined (Value)".
Definition view.hpp:306
friend bool operator!=(b_undefined const &lhs, b_undefined const &rhs)
Return false.
Definition view.hpp:322
friend bool operator==(b_undefined const &, b_undefined const &)
Return true.
Definition view.hpp:315
static constexpr id type_id
The type represented by this BSON type value.
Definition view.hpp:310
Provides bsoncxx::v1::array::view.
Provides bsoncxx::v1::decimal128.
For internal use only!
Provides bsoncxx::v1::document::view.
Provides bsoncxx::v1::oid.
Provides std::string_view-related polyfills for library API usage.
#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.
Declares non-owning, read-only entities representing a BSON type value.