userver
C++ Async Framework
Loading...
Searching...
No Matches
binary.hpp
Go to the documentation of this file.
1
#
pragma
once
2
3
/// @file userver/formats/bson/binary.hpp
4
/// @brief Binary representation helpers
5
6
#
include
<
string
>
7
#
include
<
string_view
>
8
9
#
include
<
userver
/
formats
/
bson
/
document
.
hpp
>
10
#
include
<
userver
/
formats
/
bson
/
types
.
hpp
>
11
12
USERVER_NAMESPACE_BEGIN
13
14
namespace
formats
::
bson
{
15
16
/// Wraps BSON binary representation
17
class
BsonString
;
18
19
/// Recovers a BSON document from its binary form
20
Document
FromBinaryString
(std::string_view binary);
21
22
/// Dumps a bson document to a binary string
23
BsonString
ToBinaryString
(
const
formats
::
bson
::
Document
&);
24
25
namespace
impl {
26
class
BsonStringImpl;
27
}
// namespace impl
28
29
class
BsonString
{
30
public
:
31
/// @cond
32
explicit
BsonString(impl::BsonHolder);
33
/// @endcond
34
35
/// Implicitly convertible to string
36
/*implicit*/
operator
std::string()
const
{
return
ToString(); }
37
38
/// Returns a copy of the binary
39
std::string
ToString
()
const
;
40
41
/// Returns a view of the binary
42
std
::
string_view
GetView
()
const
;
43
44
const
uint8_t* Data()
const
;
45
size_t Size()
const
;
46
47
private
:
48
impl::BsonHolder impl_;
49
};
50
51
}
// namespace formats::bson
52
53
USERVER_NAMESPACE_END
userver
formats
bson
binary.hpp
Generated on Wed Dec 4 2024 18:48:18 for userver by
Doxygen
1.10.0