userver
C++ Async Framework
Toggle main menu visibility
Loading...
Searching...
No Matches
serialize.hpp
Go to the documentation of this file.
1
#
pragma
once
2
3
/// @file userver/formats/yaml/serialize.hpp
4
/// @brief Parsers and serializers to/from string and stream
5
6
#
include
<
iosfwd
>
7
8
#
include
<
userver
/
formats
/
json_fwd
.
hpp
>
9
#
include
<
userver
/
formats
/
yaml
/
value
.
hpp
>
10
11
USERVER_NAMESPACE_BEGIN
12
13
namespace
formats::
parse
{
14
15
/// @brief Converts a YAML value to JSON format
16
///
17
/// @throws formats::yaml::Exception if the YAML value is missing or contains
18
/// an unknown node type that cannot be converted to JSON
19
formats::
json
::
Value
Parse
(
const
formats::
yaml
::Value& yaml, formats::
parse
::
To
<formats::
json
::
Value
>);
20
21
/// @brief Converts a JSON value to YAML format
22
///
23
/// @throws formats::json::Exception if the JSON value is missing or contains
24
/// an unknown node type that cannot be converted to YAML
25
formats::
yaml
::Value
Parse
(
const
formats::
json
::
Value
& json, formats::
parse
::
To
<formats::
yaml
::Value>);
26
27
/// @brief Converts a YAML value to JSON string format
28
///
29
/// @throws formats::yaml::Exception if the YAML value is missing or contains
30
/// an unknown node type that cannot be converted to JSON
31
formats::
json
::
RawString
Parse
(
const
formats::
yaml
::Value& value, formats::
parse
::
To
<formats::
json
::
RawString
>);
32
33
}
// namespace formats::parse
34
35
namespace
formats::
yaml
{
36
37
/// Parse YAML from string
38
formats::
yaml
::Value
FromString
(
const
std::string& doc);
39
40
/// Parse YAML from stream
41
formats::
yaml
::Value
FromStream
(std::istream& is);
42
43
/// Serialize YAML to stream
44
void
Serialize
(
const
formats::
yaml
::Value& doc, std::ostream& os);
45
46
/// Serialize YAML to string
47
std::string
ToString
(
const
formats::
yaml
::Value& doc);
48
49
/// @brief Blocking operations that should not be used on main task processor after startup
50
namespace
blocking
{
51
/// @brief Read YAML from file
52
/// @see formats::yaml::FromFile
53
formats::
yaml
::Value
FromFile
(
const
std::string& path);
54
}
// namespace blocking
55
56
namespace
impl {
57
formats::
yaml
::Value FromStringAllowRepeatedKeys(
const
std::string& doc);
58
}
// namespace impl
59
60
}
// namespace formats::yaml
61
62
USERVER_NAMESPACE_END
userver
formats
yaml
serialize.hpp
Generated on
for userver by
Doxygen
1.17.0