| 17 | |
| 18 | template <bool ThrowOnError> |
| 19 | std::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 |
nothing calls this directly
no test coverage detected