MongoDB C++ Driver mongocxx-4.0.0
Loading...
Searching...
No Matches
array.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
18
26
28
29namespace bsoncxx {
30namespace v_noabi {
31namespace builder {
32namespace stream {
33
42class array : public array_context<> {
43 public:
47 array() : array_context<>(&_core), _core(true) {}
48
53 return _core.view_array();
54 }
55
60 return view();
61 }
62
75
79 void clear() {
80 _core.clear();
81 }
82
83 private:
84 core _core;
85};
86
87} // namespace stream
88} // namespace builder
89} // namespace v_noabi
90} // namespace bsoncxx
91
93
Provides bsoncxx::v_noabi::array::value.
Provides bsoncxx::v_noabi::array::view.
Provides bsoncxx::v_noabi::builder::stream::array_context.
The bsoncxx macro guard postlude header.
The bsoncxx macro guard prelude header.
A read-only BSON array that owns its underlying buffer. When a array::value goes out of scope,...
Definition value.hpp:36
A read-only, non-owning view of a BSON document.
Definition view.hpp:36
A low-level interface for constructing BSON documents and arrays.
Definition core.hpp:46
void clear()
Deletes the contents of the underlying BSON datum. After calling clear(), the state of this class wil...
bsoncxx::v_noabi::array::view view_array() const
Gets a view over the array.
bsoncxx::v_noabi::array::value extract_array()
Transfers ownership of the underlying document to the caller.
A stream context which expects any number of values.
Definition array_context.hpp:51
A streaming interface for constructing a BSON array.
Definition array.hpp:42
array()
Default constructor.
Definition array.hpp:47
bsoncxx::v_noabi::array::view view() const
Definition array.hpp:52
bsoncxx::v_noabi::array::value extract()
Transfer ownership of the underlying array to the caller.
Definition array.hpp:72
void clear()
Reset the underlying BSON to an empty array.
Definition array.hpp:79
Provides bsoncxx::v_noabi::builder::core.
Provides bsoncxx::v_noabi::builder::stream::key_context.
The top-level namespace within which all bsoncxx library entities are declared.
Provides bsoncxx::v_noabi::builder::stream::single_context.
Declares bsoncxx::v_noabi::builder::stream::array.
Provides bsoncxx::v_noabi::builder::stream::value_context.