MongoDB C++ Driver  mongocxx-3.10.2
concatenate.hpp
1 // Copyright 2015 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/concatenate-fwd.hpp>
18 
19 #include <bsoncxx/array/view_or_value.hpp>
20 #include <bsoncxx/document/view_or_value.hpp>
21 
22 #include <bsoncxx/config/prelude.hpp>
23 
24 namespace bsoncxx {
25 namespace v_noabi {
26 namespace builder {
27 
34 
35  // MSVC seems to need a hint that it should always
36  // inline this destructor.
37  BSONCXX_INLINE ~concatenate_doc() = default;
38 
45  BSONCXX_INLINE operator document::view() const {
46  return doc;
47  }
48 
55  BSONCXX_INLINE document::view view() const {
56  return doc;
57  }
58 };
59 
66 
67  // MSVC seems to need a hint that it should always
68  // inline this destructor.
69  BSONCXX_INLINE ~concatenate_array() = default;
70 
77  BSONCXX_INLINE operator array::view() const {
78  return array;
79  }
80 
87  BSONCXX_INLINE array::view view() const {
88  return array;
89  }
90 };
91 
103  return {std::move(doc)};
104 }
105 
117  return {std::move(array)};
118 }
119 
120 } // namespace builder
121 } // namespace v_noabi
122 } // namespace bsoncxx
123 
124 namespace bsoncxx {
125 namespace builder {
126 
127 using ::bsoncxx::v_noabi::builder::concatenate;
128 
129 } // namespace builder
130 } // namespace bsoncxx
131 
132 #include <bsoncxx/config/postlude.hpp>
A read-only, non-owning view of a BSON document.
Definition: view.hpp:36
A JSON-like builder for creating arrays.
Definition: list.hpp:180
bson_value::view view()
Provides a view of the underlying BSON value.
Definition: list.hpp:103
A read-only, non-owning view of a BSON document.
Definition: view.hpp:35
The top-level namespace for bsoncxx library entities.
Definition: element-fwd.hpp:19
Container to concatenate an array.
Definition: concatenate.hpp:64
array::view view() const
Accessor that provides a view of the wrapped concatenate array.
Definition: concatenate.hpp:87
concatenate_array concatenate(array::view_or_value array)
Method to concatenate an array with a new array.
Definition: concatenate.hpp:116
Container to concatenate a document.
Definition: concatenate.hpp:32
concatenate_doc concatenate(document::view_or_value doc)
Helper method to concatenate a document.
Definition: concatenate.hpp:102
document::view view() const
Accessor that provides a view of the wrapped concatenate document.
Definition: concatenate.hpp:55