MCPcopy Create free account
hub / github.com/catboost/catboost / DecodeEnumValueImpl

Function DecodeEnumValueImpl

library/cpp/yt/string/enum.cpp:19–33  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

17
18template <bool ThrowOnError>
19std::optional<std::string> DecodeEnumValueImpl(TStringBuf value)
20{
21 auto camelValue = UnderscoreCaseToCamelCase(value);
22 auto underscoreValue = CamelCaseToUnderscoreCase(camelValue);
23 if (value != underscoreValue) {
24 if constexpr (ThrowOnError) {
25 throw TSimpleException(Format("Enum value %Qv is not in a proper underscore case; did you mean %Qv?",
26 value,
27 underscoreValue));
28 } else {
29 return std::nullopt;
30 }
31 }
32 return camelValue;
33}
34
35} // namespace NDetail
36

Callers

nothing calls this directly

Calls 4

TSimpleExceptionClass · 0.85
FormatFunction · 0.70

Tested by

no test coverage detected