userver
C++ Async Framework
Loading...
Searching...
No Matches
helpers.hpp
1
#
pragma
once
2
3
#
include
<
string
>
4
5
#
include
<
userver
/
compiler
/
demangle
.
hpp
>
6
#
include
<
userver
/
formats
/
json
/
value
.
hpp
>
7
8
USERVER_NAMESPACE_BEGIN
9
10
namespace
storages::
secdist
{
11
12
[[
noreturn
]]
void
ThrowInvalidSecdistType(
const
formats
::
json
::Value& val,
const
std::string& type);
13
14
std::string GetString(
const
formats
::
json
::Value& parent_val,
const
std::string& name);
15
16
int
GetInt(
const
formats
::
json
::Value& parent_val,
const
std::string& name,
int
dflt);
17
18
template
<
typename
T>
19
T GetValue(
const
formats
::
json
::Value& parent_val,
const
std::string& key,
const
T& dflt) {
20
const
auto
& val = parent_val[key];
21
try
{
22
return
val.
template
As<T>(dflt);
23
}
catch
(
const
formats
::
json
::
TypeMismatchException
&) {
24
ThrowInvalidSecdistType(val, compiler::GetTypeName<T>());
25
}
26
}
27
28
void
CheckIsObject(
const
formats
::
json
::Value& val,
const
std::string& name);
29
30
void
CheckIsArray(
const
formats
::
json
::Value& val,
const
std::string& name);
31
32
}
// namespace storages::secdist
33
34
USERVER_NAMESPACE_END
userver
storages
secdist
helpers.hpp
Generated on Wed Dec 4 2024 18:46:49 for userver by
Doxygen
1.10.0