diff options
Diffstat (limited to 'library/cpp/protobuf/util/pb_io.cpp')
-rw-r--r-- | library/cpp/protobuf/util/pb_io.cpp | 70 |
1 files changed, 35 insertions, 35 deletions
diff --git a/library/cpp/protobuf/util/pb_io.cpp b/library/cpp/protobuf/util/pb_io.cpp index f26b5322c9..6270ee0624 100644 --- a/library/cpp/protobuf/util/pb_io.cpp +++ b/library/cpp/protobuf/util/pb_io.cpp @@ -23,50 +23,50 @@ namespace NProtoBuf { void ParseFromBase64String(const TStringBuf dataBase64, Message& m, bool allowUneven) { if (!m.ParseFromString(allowUneven ? Base64DecodeUneven(dataBase64) : Base64StrictDecode(dataBase64))) { - ythrow yexception() << "can't parse " << m.GetTypeName() << " from base64-encoded string"; - } - } + ythrow yexception() << "can't parse " << m.GetTypeName() << " from base64-encoded string"; + } + } bool TryParseFromBase64String(const TStringBuf dataBase64, Message& m, bool allowUneven) { - try { + try { ParseFromBase64String(dataBase64, m, allowUneven); - return true; - } catch (const std::exception&) { - return false; - } + return true; + } catch (const std::exception&) { + return false; + } } - void SerializeToBase64String(const Message& m, TString& dataBase64) { - TString rawData; - if (!m.SerializeToString(&rawData)) { - ythrow yexception() << "can't serialize " << m.GetTypeName(); - } - - Base64EncodeUrl(rawData, dataBase64); + void SerializeToBase64String(const Message& m, TString& dataBase64) { + TString rawData; + if (!m.SerializeToString(&rawData)) { + ythrow yexception() << "can't serialize " << m.GetTypeName(); + } + + Base64EncodeUrl(rawData, dataBase64); } - - TString SerializeToBase64String(const Message& m) { - TString s; - SerializeToBase64String(m, s); - return s; + + TString SerializeToBase64String(const Message& m) { + TString s; + SerializeToBase64String(m, s); + return s; } - bool TrySerializeToBase64String(const Message& m, TString& dataBase64) { - try { - SerializeToBase64String(m, dataBase64); - return true; - } catch (const std::exception&) { - return false; - } + bool TrySerializeToBase64String(const Message& m, TString& dataBase64) { + try { + SerializeToBase64String(m, dataBase64); + return true; + } catch (const std::exception&) { + return false; + } } - const TString ShortUtf8DebugString(const Message& message) { - TextFormat::Printer printer; - printer.SetSingleLineMode(true); - printer.SetUseUtf8StringEscaping(true); - TString result; - printer.PrintToString(message, &result); - return result; + const TString ShortUtf8DebugString(const Message& message) { + TextFormat::Printer printer; + printer.SetSingleLineMode(true); + printer.SetUseUtf8StringEscaping(true); + TString result; + printer.PrintToString(message, &result); + return result; } bool MergePartialFromString(NProtoBuf::Message& m, const TStringBuf serializedProtoMessage) { @@ -81,7 +81,7 @@ namespace NProtoBuf { } } -int operator&(NProtoBuf::Message& m, IBinSaver& f) { +int operator&(NProtoBuf::Message& m, IBinSaver& f) { TStringStream ss; if (f.IsReading()) { f.Add(0, &ss.Str()); |