userver
C++ Async Framework
Toggle main menu visibility
Documentation
API Groups
Namespaces
Reference
Class List
Class Index
File List
Macros
All
e
i
l
r
t
u
Functions
Macros
e
i
l
r
t
u
Examples
•
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Modules
Pages
Concepts
Loading...
Searching...
No Matches
json_string.hpp
Go to the documentation of this file.
1
#
pragma
once
2
3
/// @file userver/logging/json_string.hpp
4
/// @brief @copybrief logging::JsonString
5
6
#
include
<
string
>
7
#
include
<
string_view
>
8
9
#
include
<
userver
/
formats
/
json_fwd
.
hpp
>
10
11
USERVER_NAMESPACE_BEGIN
12
13
namespace
logging
{
14
15
/// One line json string.
16
/// JSON log formats write such tags directly as a sub-JSON, without packing them in a string.
17
class
JsonString
{
18
public
:
19
/// @brief Constructs from provided json object.
20
/// The generated json string is an one line string.
21
/*implicit*/
JsonString
(
const
formats
::
json
::Value& value);
22
23
/// @brief Constructs from provided json string. It is the user's
24
/// responsibility to ensure that the input json string is valid.
25
/// New lines will be removed during construction.
26
explicit
JsonString
(std::string json)
noexcept
;
27
28
/// @brief Constructs null json (see GetValue for details)
29
JsonString
()
noexcept
=
default
;
30
31
JsonString(
JsonString
&&)
noexcept
=
default
;
32
JsonString(
const
JsonString
&) =
default
;
33
34
JsonString
& operator=(
JsonString
&&)
noexcept
=
default
;
35
JsonString
& operator=(
const
JsonString
&) =
default
;
36
37
/// @brief Returns view to json
38
std
::
string_view
GetView
()
const
noexcept
;
39
40
private
:
41
std::string json_;
42
};
43
44
void
WriteToStream(
const
JsonString
& value,
formats
::
json
::StringBuilder& sw);
45
46
}
// namespace logging
47
48
USERVER_NAMESPACE_END
userver
logging
json_string.hpp
Generated on Thu Mar 27 2025 11:46:16 for userver by
Doxygen
1.10.0