MongoDB C++ Driver mongocxx-3.11.0
Loading...
Searching...
No Matches
document.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
24
26
27namespace bsoncxx {
28namespace v_noabi {
29namespace builder {
30namespace stream {
31
40class document : public key_context<> {
41 public:
45 document() : key_context<>(&_core), _core(false) {}
46
51 return _core.view_document();
52 }
53
58 return view();
59 }
60
73
77 void clear() {
78 _core.clear();
79 }
80
81 private:
82 core _core;
83};
84
85} // namespace stream
86} // namespace builder
87} // namespace v_noabi
88} // namespace bsoncxx
89
91
The bsoncxx macro guard postlude header.
The bsoncxx macro guard prelude header.
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::document::value extract_document()
Transfers ownership of the underlying document to the caller.
bsoncxx::v_noabi::document::view view_document() const
Gets a view over the document.
A streaming interface for constructing a BSON document.
Definition document.hpp:40
bsoncxx::v_noabi::document::view view() const
Definition document.hpp:50
bsoncxx::v_noabi::document::value extract()
Transfer ownership of the underlying document to the caller.
Definition document.hpp:70
void clear()
Reset the underlying BSON to an empty document.
Definition document.hpp:77
document()
Default constructor.
Definition document.hpp:45
A stream context which expects a key, which can later be followed by value, then more key/value pairs...
Definition key_context.hpp:51
A read-only BSON document that owns its underlying buffer. When a document::value goes out of scope,...
Definition value.hpp:38
A read-only, non-owning view of a BSON document.
Definition view.hpp:35
Provides bsoncxx::v_noabi::builder::core.
Provides bsoncxx::v_noabi::document::value.
Provides bsoncxx::v_noabi::document::view.
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::document.