MongoDB C++ Driver
mongocxx-3.0.3
Main Page
Related Pages
Classes
Files
File List
src
bsoncxx
builder
stream
array.hpp
1
// Copyright 2014 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.hpp>
18
#include <bsoncxx/array/value.hpp>
19
#include <bsoncxx/builder/core.hpp>
20
#include <bsoncxx/builder/stream/array_context.hpp>
21
#include <bsoncxx/builder/stream/key_context.hpp>
22
#include <bsoncxx/builder/stream/single_context.hpp>
23
#include <bsoncxx/builder/stream/value_context.hpp>
24
25
#include <bsoncxx/config/prelude.hpp>
26
27
namespace
bsoncxx
{
28
BSONCXX_INLINE_NAMESPACE_BEGIN
29
namespace
builder {
30
namespace
stream {
31
36
class
array
:
public
array_context
<> {
37
public
:
41
BSONCXX_INLINE
array
() :
array_context
<>(&_core), _core(true) {
42
}
43
47
BSONCXX_INLINE
bsoncxx::array::view
view
()
const
{
48
return
_core.
view_array
();
49
}
50
54
BSONCXX_INLINE
operator
bsoncxx::array::view
()
const
{
55
return
view
();
56
}
57
67
BSONCXX_INLINE
bsoncxx::array::value
extract
() {
68
return
_core.
extract_array
();
69
}
70
74
BSONCXX_INLINE
void
clear
() {
75
_core.
clear
();
76
}
77
78
private
:
79
core
_core;
80
};
81
82
}
// namespace stream
83
}
// namespace builder
84
BSONCXX_INLINE_NAMESPACE_END
85
}
// namespace bsoncxx
86
87
#include <bsoncxx/config/postlude.hpp>
bsoncxx::builder::core
A low-level interface for constructing BSON documents and arrays.
Definition:
core.hpp:42
bsoncxx::array::value
A read-only BSON array that owns its underlying buffer.
Definition:
value.hpp:34
bsoncxx::builder::stream::array_context
A stream context which expects any number of values.
Definition:
array_context.hpp:52
bsoncxx::builder::stream::array::array
array()
Default constructor.
Definition:
array.hpp:41
bsoncxx::builder::stream::array
A streaming interface for constructing a BSON array.
Definition:
array.hpp:36
bsoncxx::builder::stream::array::extract
bsoncxx::array::value extract()
Transfer ownership of the underlying array to the caller.
Definition:
array.hpp:67
bsoncxx::builder::core::clear
void clear()
Delete the contents of the underlying BSON datum.
bsoncxx::array::view
A read-only, non-owning view of a BSON document.
Definition:
view.hpp:33
bsoncxx::builder::core::view_array
array::view view_array() const
Get a view over the array.
bsoncxx::builder::stream::array::clear
void clear()
Reset the underlying BSON to an empty array.
Definition:
array.hpp:74
bsoncxx::builder::core::extract_array
array::value extract_array()
Transfer ownership of the underlying document to the caller.
bsoncxx::builder::stream::array::view
bsoncxx::array::view view() const
Definition:
array.hpp:47
bsoncxx
Definition:
element.hpp:24
Generated by
1.8.10