MongoDB C++ Driver
4.1.0
Toggle main menu visibility
Main Page
Files
File List
File Members
All
Macros
Namespaces
Namespace List
Namespace Members
All
b
c
e
f
k
l
m
o
r
s
t
v
w
Functions
c
e
f
k
m
o
s
t
v
Variables
Typedefs
Enumerations
Classes
Class List
Class Index
Class Hierarchy
Class Members
All
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
z
~
Functions
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
z
~
Variables
Typedefs
b
c
d
e
f
i
k
n
p
r
v
w
Enumerations
Related Symbols
o
Topics
•
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Pages
Loading...
Searching...
No Matches
bsoncxx
v_noabi
bsoncxx
json.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 <string>
18
19
#include <
bsoncxx/json-fwd.hpp
>
20
21
#include <
bsoncxx/array/view.hpp
>
22
#include <
bsoncxx/document/value.hpp
>
23
#include <
bsoncxx/document/view.hpp
>
24
#include <
bsoncxx/stdx/optional.hpp
>
25
26
#include <
bsoncxx/config/prelude.hpp
>
27
28
namespace
bsoncxx
{
29
namespace
v_noabi
{
30
33
enum class
ExtendedJsonMode
: std::uint8_t {
34
k_legacy
,
35
k_canonical
,
36
k_relaxed
,
37
};
33
enum class
ExtendedJsonMode
: std::uint8_t {
…
};
38
52
53
BSONCXX_ABI_EXPORT_CDECL
(std::string)
54
to_json
(
document
::view view,
ExtendedJsonMode
mode =
ExtendedJsonMode
::
k_legacy
);
55
56
BSONCXX_ABI_EXPORT_CDECL
(std::
string
)
57
to_json
(
array
::view view,
ExtendedJsonMode
mode =
ExtendedJsonMode
::
k_legacy
);
58
61
71
BSONCXX_ABI_EXPORT_CDECL
(
document
::value)
from_json
(
stdx
::string_view json);
72
85
BSONCXX_ABI_EXPORT_CDECL
(
document
::value) operator
""
_bson(
char
const* json,
size_t
len);
86
87
}
// namespace v_noabi
88
}
// namespace bsoncxx
89
90
namespace
bsoncxx
{
91
92
using
::
bsoncxx::v_noabi::from_json
;
93
using
::
bsoncxx::v_noabi::to_json
;
94
95
using
::bsoncxx::v_noabi::operator
""
_bson;
96
97
}
// namespace bsoncxx
98
99
#include <
bsoncxx/config/postlude.hpp
>
100
view.hpp
Provides bsoncxx::v_noabi::array::view.
BSONCXX_ABI_EXPORT_CDECL
#define BSONCXX_ABI_EXPORT_CDECL(...)
Equivalent to BSONCXX_ABI_EXPORT with BSONCXX_ABI_CDECL.
Definition
export.hpp:52
postlude.hpp
The bsoncxx v_noabi macro guard postlude header.
prelude.hpp
The bsoncxx v_noabi macro guard prelude header.
value.hpp
Provides bsoncxx::v_noabi::document::value.
view.hpp
Provides bsoncxx::v_noabi::document::view.
json-fwd.hpp
Declares bsoncxx::v_noabi::ExtendedJsonMode.
bsoncxx::v_noabi::array
Declares entities representing a BSON array.
bsoncxx::v_noabi::document
Declares entities representing a BSON document.
bsoncxx::v_noabi::stdx
Declares C++17 standard library polyfills.
bsoncxx::v_noabi
Declares entities whose ABI stability is NOT guaranteed.
bsoncxx::v_noabi::to_json
std::string to_json(document::view view, ExtendedJsonMode mode=ExtendedJsonMode::k_legacy)
Converts a BSON document to a JSON string, in extended format.
bsoncxx::v_noabi::ExtendedJsonMode
ExtendedJsonMode
An enumeration of the types of Extended JSON that the to_json function accepts.
Definition
json.hpp:33
bsoncxx::v_noabi::ExtendedJsonMode::k_relaxed
@ k_relaxed
to produce Relaxed Extended JSON
Definition
json.hpp:36
bsoncxx::v_noabi::ExtendedJsonMode::k_legacy
@ k_legacy
to produce Legacy Extended JSON
Definition
json.hpp:34
bsoncxx::v_noabi::ExtendedJsonMode::k_canonical
@ k_canonical
to produce Canonical Extended JSON
Definition
json.hpp:35
bsoncxx::v_noabi::from_json
document::value from_json(stdx::string_view json)
Constructs a new document::value from the provided JSON text.
bsoncxx
The top-level namespace within which all bsoncxx library entities are declared.
optional.hpp
Provides std::optional-related polyfills for library API usage.
Generated by
1.13.2