Loading...
Searching...
No Matches
sub_array.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/basic/sub_array-fwd.hpp>
#include <bsoncxx/builder/basic/helpers.hpp> // IWYU pragma: keep: backward compatibility, to be removed.
#include <bsoncxx/builder/concatenate.hpp>
#include <bsoncxx/builder/core.hpp>
#include <bsoncxx/config/prelude.hpp>
namespace bsoncxx {
namespace v_noabi {
namespace builder {
namespace basic {
namespace impl {
template <typename T>
void value_append(core* core, T&& t);
} // namespace impl
class sub_array {
public:
sub_array(core* core) : _core(core) {}
template <typename Arg, typename... Args>
void append(Arg&& a, Args&&... args) {
append_(std::forward<Arg>(a));
append(std::forward<Args>(args)...);
}
void append() {}
private:
//
// Appends a BSON value.
//
template <typename T>
void append_(T&& t) {
impl::value_append(_core, std::forward<T>(t));
}
//
// Concatenates another bson array directly.
//
void append_(concatenate_array array) {
_core->concatenate(array.view());
}
core* _core;
};
} // namespace basic
} // namespace builder
} // namespace v_noabi
} // namespace bsoncxx
#include <bsoncxx/config/postlude.hpp>
helpers.hpp
Redeclares bsoncxx::v_noabi::builder::concatenate in the bsoncxx::v_noabi::builder::basic namespace.
postlude.hpp
The bsoncxx v_noabi macro guard postlude header.
prelude.hpp
The bsoncxx v_noabi macro guard prelude header.
bsoncxx::builder::basic::sub_array::sub_array
sub_array(core *core)
Default constructor.
Definition sub_array.hpp:49
bsoncxx::v_noabi::builder::array
A JSON-like builder for creating arrays.
Definition list.hpp:174
bsoncxx::v_noabi::builder::basic::sub_array::append
void append()
Inductive base-case for the variadic append(...).
Definition sub_array.hpp:63
bsoncxx::v_noabi::builder::basic::sub_array::sub_array
sub_array(core *core)
Default constructor.
Definition sub_array.hpp:49
bsoncxx::v_noabi::builder::basic::sub_array::append
void append(Arg &&a, Args &&... args)
Appends multiple BSON values.
Definition sub_array.hpp:55
bsoncxx::v_noabi::builder::core
A low-level interface for constructing BSON documents and arrays.
Definition core.hpp:46
bsoncxx::v_noabi::builder::core::concatenate
core & concatenate(v_noabi::document::view const &view)
Appends the keys from a BSON document into this BSON datum.
bsoncxx::v_noabi::builder::list::view
types::bson_value::view view()
Provides a view of the underlying BSON value.
Definition list.hpp:97
concatenate.hpp
Provides concatenators for use with "streaming" BSON builder syntax.
core.hpp
Provides bsoncxx::v_noabi::builder::core.
bsoncxx::v_noabi::builder::basic
Declares entities used with "basic" 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.
bsoncxx::v_noabi::builder::concatenate_array
Container to concatenate an array.
Definition concatenate.hpp:64
sub_array-fwd.hpp
Declares bsoncxx::v_noabi::builder::basic::sub_array.