MCPcopy Create free account
hub / github.com/apache/thrift / readMapBegin

Method readMapBegin

lib/cpp/src/thrift/protocol/TJSONProtocol.cpp:1012–1030  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1010}
1011
1012uint32_t TJSONProtocol::readMapBegin(TType& keyType, TType& valType, uint32_t& size) {
1013 uint64_t tmpVal = 0;
1014 std::string tmpStr;
1015 uint32_t result = readJSONArrayStart();
1016 result += readJSONString(tmpStr);
1017 keyType = getTypeIDForTypeName(tmpStr);
1018 result += readJSONString(tmpStr);
1019 valType = getTypeIDForTypeName(tmpStr);
1020 result += readJSONInteger(tmpVal);
1021 if (tmpVal > (std::numeric_limits<uint32_t>::max)())
1022 throw TProtocolException(TProtocolException::SIZE_LIMIT);
1023 size = static_cast<uint32_t>(tmpVal);
1024 result += readJSONObjectStart();
1025
1026 TMap map(keyType, valType, size);
1027 checkReadBytesAvailable(map);
1028
1029 return result;
1030}
1031
1032uint32_t TJSONProtocol::readMapEnd() {
1033 uint32_t result = readJSONObjectEnd();

Callers

nothing calls this directly

Calls 2

getTypeIDForTypeNameFunction · 0.85
TProtocolExceptionClass · 0.70

Tested by

no test coverage detected