MongoDB C++ Driver  mongocxx-3.0.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/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>
array::view view() const
Accessor that provides a view of the wrapped concatenate array.
Definition: concatenate.hpp:85
document::view view() const
Accessor that provides a view of the wrapped concatenate document.
Definition: concatenate.hpp:53
A read-only, non-owning view of a BSON document.
Definition: view.hpp:33
concatenate_doc concatenate(document::view_or_value doc)
Helper method to concatenate a document.
Definition: concatenate.hpp:100
Container to concatenate a document.
Definition: concatenate.hpp:30
A read-only, non-owning view of a BSON document.
Definition: view.hpp:33
Container to concatenate an array.
Definition: concatenate.hpp:62
concatenate_array concatenate(array::view_or_value array)
Method to concatenate an array with a new array.
Definition: concatenate.hpp:114
Definition: element.hpp:24