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

Function ParseUint64FromYsonString

library/cpp/yt/yson_string/convert.cpp:203–223  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

201}
202
203ui64 ParseUint64FromYsonString(const TYsonStringBuf& str)
204{
205 YT_ASSERT(str.GetType() == EYsonType::Node);
206 auto strBuf = str.AsStringBuf();
207 TMemoryInput input(strBuf.data(), strBuf.length());
208 char ch;
209 if (!input.ReadChar(ch)) {
210 throw TYsonLiteralParseException("Missing type marker");
211 }
212 if (ch != NDetail::Uint64Marker) {
213 throw TYsonLiteralParseException(Format("Unexpected %v",
214 FormatUnexpectedMarker(ch)));
215 }
216 ui64 result;
217 try {
218 ReadVarUint64(&input, &result);
219 } catch (const std::exception& ex) {
220 throw TYsonLiteralParseException(ex, "Failed to decode \"uint64\" value");
221 }
222 return result;
223}
224
225TString ParseStringFromYsonString(const TYsonStringBuf& str)
226{

Callers 1

Calls 9

FormatUnexpectedMarkerFunction · 0.85
ReadVarUint64Function · 0.85
ReadCharMethod · 0.80
FormatFunction · 0.50
GetTypeMethod · 0.45
AsStringBufMethod · 0.45
dataMethod · 0.45
lengthMethod · 0.45

Tested by

no test coverage detected