Loading...
Searching...
No Matches
document.hpp
Go to the documentation of this file.
// Copyright 2009-present MongoDB, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#pragma once
#include <bsoncxx/builder/stream/document-fwd.hpp> // IWYU pragma: export
#include <bsoncxx/builder/core.hpp>
#include <bsoncxx/builder/stream/key_context.hpp>
#include <bsoncxx/builder/stream/single_context.hpp> // IWYU pragma: keep: backward compatibility, to be removed.
#include <bsoncxx/document/value.hpp>
#include <bsoncxx/document/view.hpp>
#include <bsoncxx/config/prelude.hpp>
namespace bsoncxx {
namespace v_noabi {
namespace builder {
namespace stream {
class document : public key_context<> {
public:
document() : key_context<>(&_core), _core(false) {}
v_noabi::document::view view() const {
return _core.view_document();
}
operator v_noabi::document::view() const {
return view();
}
v_noabi::document::value extract() {
return _core.extract_document();
}
void clear() {
_core.clear();
}
private:
core _core;
};
} // namespace stream
} // namespace builder
} // namespace v_noabi
} // namespace bsoncxx
#include <bsoncxx/config/postlude.hpp>
postlude.hpp
The bsoncxx v_noabi macro guard postlude header.
prelude.hpp
The bsoncxx v_noabi macro guard prelude header.
bsoncxx::builder::stream::document::document
document()
Default constructor.
Definition document.hpp:45
bsoncxx::v_noabi::builder::stream::key_context<>::key_context
key_context(core *core)
Definition key_context.hpp:59
bsoncxx::v_noabi::builder::core
A low-level interface for constructing BSON documents and arrays.
Definition core.hpp:46
bsoncxx::v_noabi::builder::stream::document::extract
v_noabi::document::value extract()
Transfer ownership of the underlying document to the caller.
Definition document.hpp:70
bsoncxx::v_noabi::builder::stream::document::clear
void clear()
Reset the underlying BSON to an empty document.
Definition document.hpp:77
bsoncxx::v_noabi::builder::stream::document::document
document()
Default constructor.
Definition document.hpp:45
bsoncxx::v_noabi::builder::stream::document::view
v_noabi::document::view view() const
Definition document.hpp:50
bsoncxx::v_noabi::document::value
A read-only BSON document that owns its underlying buffer.
Definition value.hpp:48
bsoncxx::v_noabi::document::view
A read-only, non-owning view of a BSON document.
Definition view.hpp:40
core.hpp
Provides bsoncxx::v_noabi::builder::core.
key_context.hpp
Provides bsoncxx::v_noabi::builder::stream::key_context.
bsoncxx::v_noabi::builder::stream
Declares entities used with "streaming" BSON builder syntax.
bsoncxx::v_noabi::builder
Declares entities used to build BSON documents.
bsoncxx::v_noabi
Declares entities whose ABI stability is NOT guaranteed.
bsoncxx
The top-level namespace within which all bsoncxx library entities are declared.
single_context.hpp
Provides bsoncxx::v_noabi::builder::stream::single_context.
document-fwd.hpp
Declares bsoncxx::v_noabi::builder::stream::document.
value.hpp
Provides bsoncxx::v_noabi::document::value.
view.hpp
Provides bsoncxx::v_noabi::document::view.