MongoDB C++ Driver  mongocxx-3.4.0
element.hpp
1 // Copyright 2014 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 <cstddef>
18 #include <cstdint>
19 
20 #include <bsoncxx/document/element.hpp>
21 
22 #include <bsoncxx/config/prelude.hpp>
23 
24 namespace bsoncxx {
25 BSONCXX_INLINE_NAMESPACE_BEGIN
26 
27 namespace array {
28 
36 class BSONCXX_API element : private document::element {
37  public:
38  element();
39 
40  using document::element::operator bool;
41 
43 
65 
67 
68  using document::element::operator[];
69 
74 
75  private:
76  friend class view;
77 
78  BSONCXX_PRIVATE explicit element(const std::uint8_t* raw,
79  std::uint32_t length,
80  std::uint32_t offset,
81  std::uint32_t keylen);
82 };
83 
84 } // namespace array
85 
86 BSONCXX_INLINE_NAMESPACE_END
87 } // namespace bsoncxx
88 
89 #include <bsoncxx/config/postlude.hpp>
types::b_decimal128 get_decimal128() const
Getter for elements of the b_decimal128 type.
types::b_null get_null() const
Getter for elements of the b_null type.
types::value get_value() const
Getter for a types::value variant wrapper of the value portion of the element.
std::uint32_t keylen() const
Getter for the element&#39;s key length.
types::b_timestamp get_timestamp() const
Getter for elements of the b_timestamp type.
const std::uint8_t * raw() const
Getter for the raw bson bytes the element points to.
types::b_undefined get_undefined() const
Getter for elements of the b_undefined type.
types::b_document get_document() const
Getter for elements of the b_document type.
types::b_dbpointer get_dbpointer() const
Getter for elements of the b_dbpointer type.
types::b_int32 get_int32() const
Getter for elements of the b_int32 type.
types::b_binary get_binary() const
Getter for elements of the b_binary type.
types::b_minkey get_minkey() const
Getter for elements of the b_minkey type.
types::b_code get_code() const
Getter for elements of the b_code type.
types::b_oid get_oid() const
Getter for elements of the b_oid type.
bsoncxx::type type() const
Getter for the type of the element.
types::b_bool get_bool() const
Getter for elements of the b_bool type.
types::b_double get_double() const
Getter for elements of the b_double type.
A read-only, non-owning view of a BSON document.
Definition: view.hpp:33
types::b_maxkey get_maxkey() const
Getter for elements of the b_maxkey type.
types::b_array get_array() const
Getter for elements of the b_array type.
types::b_int64 get_int64() const
Getter for elements of the b_int64 type.
types::b_date get_date() const
Getter for elements of the b_date type.
A variant view type that accesses values in serialized BSON documents.
Definition: element.hpp:71
types::b_utf8 get_utf8() const
Getter for elements of the b_utf8 type.
std::uint32_t offset() const
Getter for the offset into the raw bson bytes the element points to.
std::uint32_t length() const
Getter for length of the raw bson bytes the element points to.
A variant view type that accesses values in serialized BSON arrays.
Definition: element.hpp:36
types::b_regex get_regex() const
Getter for elements of the b_regex type.
types::b_symbol get_symbol() const
Getter for elements of the b_symbol type.
Top level namespace for MongoDB C++ BSON functionality.
Definition: element.hpp:24
types::b_codewscope get_codewscope() const
Getter for elements of the b_codewscope type.