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

Method readJSONInteger

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

Source from the content-addressed store, hash-verified

865// returning them via num
866template <typename NumberType>
867uint32_t TJSONProtocol::readJSONInteger(NumberType& num) {
868 uint32_t result = context_->read(reader_);
869 if (context_->escapeNum()) {
870 result += readJSONSyntaxChar(kJSONStringDelimiter);
871 }
872 std::string str;
873 result += readJSONNumericChars(str);
874 try {
875 num = fromString<NumberType>(str);
876 } catch (const std::runtime_error&) {
877 throw TProtocolException(TProtocolException::INVALID_DATA,
878 "Expected numeric value; got \"" + str + "\"");
879 }
880 if (context_->escapeNum()) {
881 result += readJSONSyntaxChar(kJSONStringDelimiter);
882 }
883 return result;
884}
885
886// Reads a JSON number or string and interprets it as a double.
887uint32_t TJSONProtocol::readJSONDouble(double& num) {

Callers

nothing calls this directly

Calls 3

TProtocolExceptionClass · 0.70
readMethod · 0.65
escapeNumMethod · 0.45

Tested by

no test coverage detected