MongoDB C++ Driver
mongocxx-4.0.0
Loading...
Searching...
No Matches
bsoncxx
v_noabi
bsoncxx
array
value.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 <cstdlib>
18
#include <memory>
19
20
#include <
bsoncxx/array/value-fwd.hpp
>
21
22
#include <
bsoncxx/array/view.hpp
>
23
#include <
bsoncxx/document/value.hpp
>
24
25
#include <
bsoncxx/config/prelude.hpp
>
26
27
namespace
bsoncxx
{
28
namespace
v_noabi {
29
namespace
array {
30
36
class
value
{
37
public
:
38
using
deleter_type = void(
BSONCXX_ABI_CDECL
*)(std::uint8_t*);
39
using
unique_ptr_type = std::unique_ptr<uint8_t[], deleter_type>;
40
53
BSONCXX_ABI_EXPORT_CDECL
()
value
(
std
::uint8_t* data,
std
::
size_t
length, deleter_type dtor);
54
64
BSONCXX_ABI_EXPORT_CDECL
()
value
(unique_ptr_type ptr,
std
::
size_t
length);
65
74
explicit
BSONCXX_ABI_EXPORT_CDECL
()
value
(array::
view
view
);
75
76
BSONCXX_ABI_EXPORT_CDECL
()
value
(const
value
&);
77
BSONCXX_ABI_EXPORT_CDECL
(
value
&) operator=(const
value
&);
78
79
value
(
value
&&) = default;
80
value
& operator=(
value
&&) = default;
81
85
array::
view
view
() const noexcept {
86
return
array::view
{
static_cast<
uint8_t*
>
(_data.get()), _length};
87
}
88
94
operator
array::view
() const noexcept {
95
return
view
();
96
}
97
107
BSONCXX_ABI_EXPORT_CDECL
(unique_ptr_type)
release
();
108
109
private
:
110
unique_ptr_type _data;
111
std::size_t _length{0};
112
};
113
114
}
// namespace array
115
}
// namespace v_noabi
116
}
// namespace bsoncxx
117
118
#include <
bsoncxx/config/postlude.hpp
>
119
value-fwd.hpp
Declares bsoncxx::v_noabi::array::value.
view.hpp
Provides bsoncxx::v_noabi::array::view.
postlude.hpp
The bsoncxx macro guard postlude header.
prelude.hpp
The bsoncxx macro guard prelude header.
bsoncxx::v_noabi::array::value
A read-only BSON array that owns its underlying buffer. When a array::value goes out of scope,...
Definition
value.hpp:36
bsoncxx::v_noabi::array::value::release
unique_ptr_type release()
Transfer ownership of the underlying buffer to the caller.
bsoncxx::v_noabi::array::value::view
array::view view() const noexcept
Get a view over the document owned by this value.
Definition
value.hpp:85
bsoncxx::v_noabi::array::view
A read-only, non-owning view of a BSON document.
Definition
view.hpp:36
value.hpp
Provides bsoncxx::v_noabi::document::value.
BSONCXX_ABI_CDECL
#define BSONCXX_ABI_CDECL
Expands to __cdecl when built with MSVC on Windows.
Definition
fwd.hpp:169
BSONCXX_ABI_EXPORT_CDECL
#define BSONCXX_ABI_EXPORT_CDECL(...)
Equivalent to BSONCXX_ABI_EXPORT with BSONCXX_ABI_CDECL.
Definition
fwd.hpp:177
bsoncxx
The top-level namespace within which all bsoncxx library entities are declared.
std
The top-level namespace reserved for the C++ standard library.
Generated by
1.12.0