userver
C++ Async Framework
Toggle main menu visibility
Loading...
Searching...
No Matches
path.hpp
Go to the documentation of this file.
1
#
pragma
once
2
3
/// @file userver/formats/common/path.hpp
4
/// @brief @copybrief formats::common::Path
5
6
#
include
<
string
>
7
#
include
<
string_view
>
8
9
USERVER_NAMESPACE_BEGIN
10
11
namespace
formats::common {
12
13
inline
constexpr
char
kPathSeparator =
'.'
;
14
inline
constexpr
char
kPathRoot[] =
"/"
;
15
inline
constexpr
char
kPathPrefixSeparator[] =
":/"
;
16
17
/// Returns string of [idx], e.g. "[0]" or "[1025]"
18
std::string
GetIndexString
(size_t index);
19
20
void
AppendPath(std::string& path, std::string_view key);
21
void
AppendPath(std::string& path, std::size_t index);
22
23
std::string MakeChildPath(std::string_view parent, std::string_view key);
24
std::string MakeChildPath(std::string&& parent, std::string_view key);
25
26
std::string MakeChildPath(std::string_view parent, std::size_t index);
27
std::string MakeChildPath(std::string&& parent, std::size_t index);
28
29
/// @ingroup userver_universal
30
///
31
/// Document/array element path storage
32
class
Path
{
33
public
:
34
Path();
35
36
bool
IsRoot()
const
;
37
std::string ToString()
const
;
38
std::string_view ToStringView()
const
;
39
40
Path
MakeChildPath(std::string_view key)
const
;
41
Path
MakeChildPath(std::size_t index)
const
;
42
43
static
Path
WithPrefix(std::string path_prefix);
44
45
private
:
46
explicit
Path(std::string path);
47
48
std::string path_;
49
};
50
51
}
// namespace formats::common
52
53
USERVER_NAMESPACE_END
userver
formats
common
path.hpp
Generated on
for userver by
Doxygen
1.17.0