MongoDB C++ Driver  mongocxx-3.7.0
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/array/view_or_value.hpp>
18 #include <bsoncxx/document/view_or_value.hpp>
19 
20 #include <bsoncxx/config/prelude.hpp>
21 
22 namespace bsoncxx {
23 BSONCXX_INLINE_NAMESPACE_BEGIN
24 namespace builder {
25 
32 
33  // MSVC seems to need a hint that it should always
34  // inline this destructor.
35  BSONCXX_INLINE ~concatenate_doc() = default;
36 
43  BSONCXX_INLINE operator document::view() const {
44  return doc;
45  }
46 
53  BSONCXX_INLINE document::view view() const {
54  return doc;
55  }
56 };
57 
64 
65  // MSVC seems to need a hint that it should always
66  // inline this destructor.
67  BSONCXX_INLINE ~concatenate_array() = default;
68 
75  BSONCXX_INLINE operator array::view() const {
76  return array;
77  }
78 
85  BSONCXX_INLINE array::view view() const {
86  return array;
87  }
88 };
89 
101  return {std::move(doc)};
102 }
103 
115  return {std::move(array)};
116 }
117 
118 } // namespace builder
119 BSONCXX_INLINE_NAMESPACE_END
120 } // namespace bsoncxx
121 
122 #include <bsoncxx/config/postlude.hpp>
bsoncxx
Top level namespace for MongoDB C++ BSON functionality.
Definition: element.hpp:24
bsoncxx::view_or_value< document::view, document::value >
bsoncxx::builder::concatenate_array
Container to concatenate an array.
Definition: concatenate.hpp:62
bsoncxx::array::view
A read-only, non-owning view of a BSON document.
Definition: view.hpp:40
bsoncxx::builder::concatenate_doc
Container to concatenate a document.
Definition: concatenate.hpp:30
bsoncxx::builder::concatenate_doc::concatenate
concatenate_doc concatenate(document::view_or_value doc)
Helper method to concatenate a document.
Definition: concatenate.hpp:100
bsoncxx::builder::concatenate_doc::view
document::view view() const
Accessor that provides a view of the wrapped concatenate document.
Definition: concatenate.hpp:53
bsoncxx::builder::concatenate_array::view
array::view view() const
Accessor that provides a view of the wrapped concatenate array.
Definition: concatenate.hpp:85
bsoncxx::builder::list::view
bson_value::view view()
Provides a view of the underlying BSON value.
Definition: list.hpp:90
bsoncxx::builder::array
A JSON-like builder for creating arrays.
Definition: list.hpp:166
bsoncxx::document::view
A read-only, non-owning view of a BSON document.
Definition: view.hpp:33
bsoncxx::builder::concatenate_array::concatenate
concatenate_array concatenate(array::view_or_value array)
Method to concatenate an array with a new array.
Definition: concatenate.hpp:114