MCPcopy Create free account
hub / github.com/comaps/comaps / FromString

Function FromString

libs/base/logging.cpp:29–38  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

27}
28
29std::optional<LogLevel> FromString(std::string const & s)
30{
31 ASSERT(!s.empty(), ("Log level should not be empty"));
32
33 auto const & names = GetLogLevelNames();
34 auto const it = std::find(names.begin(), names.end(), std::toupper(s[0]));
35 if (it == names.end())
36 return {};
37 return static_cast<LogLevel>(std::distance(names.begin(), it));
38}
39
40std::array<char, NUM_LOG_LEVELS> const & GetLogLevelNames()
41{

Callers 15

ValidateLogAbortLevelFunction · 0.50
mainFunction · 0.50
ValidateLogAbortLevelFunction · 0.50
mainFunction · 0.50
CellIdMethod · 0.50
ToStringMethod · 0.50
ValidateAndFormat_vkFunction · 0.50

Calls 6

ASSERTFunction · 0.85
findFunction · 0.85
distanceFunction · 0.85
emptyMethod · 0.45
beginMethod · 0.45
endMethod · 0.45

Tested by 2

UNIT_TESTFunction · 0.40
UNIT_TESTFunction · 0.40