diff options
| author | babenko <[email protected]> | 2022-02-10 16:49:19 +0300 | 
|---|---|---|
| committer | Daniil Cherednik <[email protected]> | 2022-02-10 16:49:19 +0300 | 
| commit | cec37806d8847aa3db53bafc9e251d4aaf325c12 (patch) | |
| tree | 4a61c191e93e31d9ab423e258c71ab43550ee3d2 /library/cpp/yt/string/enum.cpp | |
| parent | 58cd0b86ed99a72df22479e26a20bc1c1e57e65e (diff) | |
Restoring authorship annotation for <[email protected]>. Commit 1 of 2.
Diffstat (limited to 'library/cpp/yt/string/enum.cpp')
| -rw-r--r-- | library/cpp/yt/string/enum.cpp | 58 | 
1 files changed, 29 insertions, 29 deletions
| diff --git a/library/cpp/yt/string/enum.cpp b/library/cpp/yt/string/enum.cpp index 7cb8e5c6b6a..5f8c032edfe 100644 --- a/library/cpp/yt/string/enum.cpp +++ b/library/cpp/yt/string/enum.cpp @@ -1,44 +1,44 @@  #include "enum.h" - +   #include "format.h" - -namespace NYT { - -//////////////////////////////////////////////////////////////////////////////// - +  +namespace NYT {  +  +////////////////////////////////////////////////////////////////////////////////  +   TString DecodeEnumValue(TStringBuf value) -{ -    auto camelValue = UnderscoreCaseToCamelCase(value); +{  +    auto camelValue = UnderscoreCaseToCamelCase(value);       auto underscoreValue = CamelCaseToUnderscoreCase(camelValue);      if (value != underscoreValue) { -        throw TSimpleException(Format("Enum value %Qv is not in a proper underscore case; did you mean %Qv?", +        throw TSimpleException(Format("Enum value %Qv is not in a proper underscore case; did you mean %Qv?",               value, -            underscoreValue)); +            underscoreValue));       } -    return camelValue; -} - +    return camelValue;  +}  +   TString EncodeEnumValue(TStringBuf value) +{  +    return CamelCaseToUnderscoreCase(value);  +}  +  +namespace NDetail {  +  +void ThrowMalformedEnumValueException(TStringBuf typeName, TStringBuf value)   { -    return CamelCaseToUnderscoreCase(value); +    throw TSimpleException(Format("Error parsing %v value %Qv",  +        typeName,  +        value));   } -namespace NDetail { - -void ThrowMalformedEnumValueException(TStringBuf typeName, TStringBuf value) -{ -    throw TSimpleException(Format("Error parsing %v value %Qv", -        typeName, -        value)); -} - -void FormatUnknownEnumValue(TStringBuilderBase* builder, TStringBuf name, i64 value) +void FormatUnknownEnumValue(TStringBuilderBase* builder, TStringBuf name, i64 value)   {      builder->AppendFormat("%v(%v)", name, value);  } -} // namespace NDetail - -//////////////////////////////////////////////////////////////////////////////// - -} // namespace NYT +} // namespace NDetail  +  +////////////////////////////////////////////////////////////////////////////////  +  +} // namespace NYT  | 
