MongoDB C++ Driver
current
Loading...
Searching...
No Matches
bsoncxx
v_noabi
bsoncxx
builder
basic
sub_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
17
#include <
bsoncxx/builder/basic/sub_array-fwd.hpp
>
18
19
#include <
bsoncxx/builder/basic/helpers.hpp
>
20
#include <
bsoncxx/builder/concatenate.hpp
>
21
#include <
bsoncxx/builder/core.hpp
>
22
23
#include <
bsoncxx/config/prelude.hpp
>
24
25
namespace
bsoncxx
{
26
namespace
v_noabi {
27
namespace
builder {
28
namespace
basic {
29
30
namespace
impl {
31
32
template
<
typename
T>
33
void
value_append(core* core, T&& t);
34
35
}
// namespace impl
36
44
class
sub_array
{
45
public
:
49
sub_array
(
core
*
core
) : _core(
core
) {}
50
54
template
<
typename
Arg,
typename
... Args>
55
void
append
(Arg&& a, Args&&... args) {
56
append_(std::forward<Arg>(a));
57
append
(std::forward<Args>(args)...);
58
}
59
63
void
append
() {}
64
65
private
:
66
//
67
// Appends a BSON value.
68
//
69
template
<
typename
T>
70
void
append_(T&& t) {
71
impl::value_append(_core, std::forward<T>(t));
72
}
73
74
//
75
// Concatenates another bson array directly.
76
//
77
void
append_(
concatenate_array
array
) {
78
_core->
concatenate
(
array
.
view
());
79
}
80
81
core* _core;
82
};
83
84
}
// namespace basic
85
}
// namespace builder
86
}
// namespace v_noabi
87
}
// namespace bsoncxx
88
89
#include <
bsoncxx/config/postlude.hpp
>
90
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::v_noabi::builder::array
A JSON-like builder for creating arrays.
Definition
list.hpp:174
bsoncxx::v_noabi::builder::basic::sub_array
Represents an array element being constructed during an append operation.
Definition
sub_array.hpp:44
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(bsoncxx::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
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.
Generated by
1.9.8