Classes | Public Types | Public Member Functions | Private Types | Private Member Functions | Private Attributes | Friends | List of all members
google::protobuf::util::converter::JsonStreamParser Class Reference

#include <json_stream_parser.h>

Classes

struct  NumberResult
 

Public Types

enum  ParseErrorType {
  UNKNOWN_PARSE_ERROR, OCTAL_OR_HEX_ARE_NOT_VALID_JSON_VALUES, EXPECTED_COLON, EXPECTED_COMMA_OR_BRACKET,
  EXPECTED_VALUE, EXPECTED_COMMA_OR_BRACES, EXPECTED_OBJECT_KEY_OR_BRACES, EXPECTED_VALUE_OR_BRACKET,
  INVALID_KEY_OR_VARIABLE_NAME, NON_UTF_8, PARSING_TERMINATED_BEFORE_END_OF_INPUT, UNEXPECTED_TOKEN,
  EXPECTED_CLOSING_QUOTE, ILLEGAL_HEX_STRING, INVALID_ESCAPE_SEQUENCE, MISSING_LOW_SURROGATE,
  INVALID_LOW_SURROGATE, INVALID_UNICODE, UNABLE_TO_PARSE_NUMBER, NUMBER_EXCEEDS_RANGE_DOUBLE
}
 

Public Member Functions

util::Status FinishParse ()
 
util::Status FinishParse ()
 
 JsonStreamParser (ObjectWriter *ow)
 
 JsonStreamParser (ObjectWriter *ow)
 
util::Status Parse (StringPiece json)
 
util::Status Parse (StringPiece json)
 
void set_max_recursion_depth (int max_depth)
 
void set_max_recursion_depth (int max_depth)
 
virtual ~JsonStreamParser ()
 
virtual ~JsonStreamParser ()
 

Private Types

enum  ParseType {
  VALUE, OBJ_MID, ENTRY, ENTRY_MID,
  ARRAY_VALUE, ARRAY_MID, VALUE, OBJ_MID,
  ENTRY, ENTRY_MID, ARRAY_VALUE, ARRAY_MID
}
 
enum  ParseType {
  VALUE, OBJ_MID, ENTRY, ENTRY_MID,
  ARRAY_VALUE, ARRAY_MID, VALUE, OBJ_MID,
  ENTRY, ENTRY_MID, ARRAY_VALUE, ARRAY_MID
}
 
enum  TokenType {
  BEGIN_STRING, BEGIN_NUMBER, BEGIN_TRUE, BEGIN_FALSE,
  BEGIN_NULL, BEGIN_OBJECT, END_OBJECT, BEGIN_ARRAY,
  END_ARRAY, ENTRY_SEPARATOR, VALUE_SEPARATOR, BEGIN_KEY,
  UNKNOWN, BEGIN_STRING, BEGIN_NUMBER, BEGIN_TRUE,
  BEGIN_FALSE, BEGIN_NULL, BEGIN_OBJECT, END_OBJECT,
  BEGIN_ARRAY, END_ARRAY, ENTRY_SEPARATOR, VALUE_SEPARATOR,
  BEGIN_KEY, UNKNOWN
}
 
enum  TokenType {
  BEGIN_STRING, BEGIN_NUMBER, BEGIN_TRUE, BEGIN_FALSE,
  BEGIN_NULL, BEGIN_OBJECT, END_OBJECT, BEGIN_ARRAY,
  END_ARRAY, ENTRY_SEPARATOR, VALUE_SEPARATOR, BEGIN_KEY,
  UNKNOWN, BEGIN_STRING, BEGIN_NUMBER, BEGIN_TRUE,
  BEGIN_FALSE, BEGIN_NULL, BEGIN_OBJECT, END_OBJECT,
  BEGIN_ARRAY, END_ARRAY, ENTRY_SEPARATOR, VALUE_SEPARATOR,
  BEGIN_KEY, UNKNOWN
}
 

Private Member Functions

void Advance ()
 
void Advance ()
 
TokenType GetNextTokenType ()
 
TokenType GetNextTokenType ()
 
 GOOGLE_DISALLOW_IMPLICIT_CONSTRUCTORS (JsonStreamParser)
 
 GOOGLE_DISALLOW_IMPLICIT_CONSTRUCTORS (JsonStreamParser)
 
util::Status HandleBeginArray ()
 
util::Status HandleBeginArray ()
 
util::Status HandleBeginObject ()
 
util::Status HandleBeginObject ()
 
util::Status IncrementRecursionDepth (StringPiece key) const
 
util::Status IncrementRecursionDepth (StringPiece key) const
 
bool IsEmptyNullAllowed (TokenType type)
 
bool IsEmptyNullAllowed (TokenType type)
 
bool IsInputAllWhiteSpaces (TokenType type)
 
util::Status ParseArrayMid (TokenType type)
 
util::Status ParseArrayMid (TokenType type)
 
util::Status ParseArrayValue (TokenType type)
 
util::Status ParseArrayValue (TokenType type)
 
util::Status ParseChunk (StringPiece chunk)
 
util::Status ParseChunk (StringPiece json)
 
util::Status ParseDoubleHelper (const std::string &number, NumberResult *result)
 
util::Status ParseDoubleHelper (const std::string &number, NumberResult *result)
 
util::Status ParseEmptyNull ()
 
util::Status ParseEmptyNull ()
 
util::Status ParseEntry (TokenType type)
 
util::Status ParseEntry (TokenType type)
 
util::Status ParseEntryMid (TokenType type)
 
util::Status ParseEntryMid (TokenType type)
 
util::Status ParseFalse ()
 
util::Status ParseFalse ()
 
util::Status ParseKey ()
 
util::Status ParseKey ()
 
util::Status ParseNull ()
 
util::Status ParseNull ()
 
util::Status ParseNumber ()
 
util::Status ParseNumber ()
 
util::Status ParseNumberHelper (NumberResult *result)
 
util::Status ParseNumberHelper (NumberResult *result)
 
util::Status ParseObjectMid (TokenType type)
 
util::Status ParseObjectMid (TokenType type)
 
util::Status ParseString ()
 
util::Status ParseString ()
 
util::Status ParseStringHelper ()
 
util::Status ParseStringHelper ()
 
util::Status ParseTrue ()
 
util::Status ParseTrue ()
 
util::Status ParseUnicodeEscape ()
 
util::Status ParseUnicodeEscape ()
 
util::Status ParseValue (TokenType type)
 
util::Status ParseValue (TokenType type)
 
int recursion_depth ()
 
int recursion_depth ()
 
util::Status ReportFailure (StringPiece message)
 
util::Status ReportFailure (StringPiece message, ParseErrorType parse_code)
 
util::Status ReportUnknown (StringPiece message)
 
util::Status ReportUnknown (StringPiece message, ParseErrorType parse_code)
 
util::Status RunParser ()
 
util::Status RunParser ()
 
void SkipWhitespace ()
 
void SkipWhitespace ()
 

Private Attributes

bool allow_empty_null_
 
bool allow_no_root_element_
 
bool allow_permissive_key_naming_
 
std::string chunk_storage_
 
bool coerce_to_utf8_
 
bool finishing_
 
StringPiece json_
 
StringPiece key_
 
std::string key_storage_
 
std::string leftover_
 
bool loose_float_number_conversion_
 
int max_recursion_depth_
 
ObjectWriterow_
 
StringPiece p_
 
StringPiece parsed_
 
std::string parsed_storage_
 
int recursion_depth_
 
bool seen_non_whitespace_
 
std::stack< ParseTypestack_
 
char string_open_
 
std::string utf8_replacement_character_
 

Friends

class JsonStreamParserTest
 

Detailed Description

Definition at line 70 of file bloaty/third_party/protobuf/src/google/protobuf/util/internal/json_stream_parser.h.

Member Enumeration Documentation

◆ ParseErrorType

Enumerator
UNKNOWN_PARSE_ERROR 
OCTAL_OR_HEX_ARE_NOT_VALID_JSON_VALUES 
EXPECTED_COLON 
EXPECTED_COMMA_OR_BRACKET 
EXPECTED_VALUE 
EXPECTED_COMMA_OR_BRACES 
EXPECTED_OBJECT_KEY_OR_BRACES 
EXPECTED_VALUE_OR_BRACKET 
INVALID_KEY_OR_VARIABLE_NAME 
NON_UTF_8 
PARSING_TERMINATED_BEFORE_END_OF_INPUT 
UNEXPECTED_TOKEN 
EXPECTED_CLOSING_QUOTE 
ILLEGAL_HEX_STRING 
INVALID_ESCAPE_SEQUENCE 
MISSING_LOW_SURROGATE 
INVALID_LOW_SURROGATE 
INVALID_UNICODE 
UNABLE_TO_PARSE_NUMBER 
NUMBER_EXCEEDS_RANGE_DOUBLE 

Definition at line 101 of file protobuf/src/google/protobuf/util/internal/json_stream_parser.h.

◆ ParseType [1/2]

Enumerator
VALUE 
OBJ_MID 
ENTRY 
ENTRY_MID 
ARRAY_VALUE 
ARRAY_MID 
VALUE 
OBJ_MID 
ENTRY 
ENTRY_MID 
ARRAY_VALUE 
ARRAY_MID 

Definition at line 112 of file bloaty/third_party/protobuf/src/google/protobuf/util/internal/json_stream_parser.h.

◆ ParseType [2/2]

Enumerator
VALUE 
OBJ_MID 
ENTRY 
ENTRY_MID 
ARRAY_VALUE 
ARRAY_MID 
VALUE 
OBJ_MID 
ENTRY 
ENTRY_MID 
ARRAY_VALUE 
ARRAY_MID 

Definition at line 145 of file protobuf/src/google/protobuf/util/internal/json_stream_parser.h.

◆ TokenType [1/2]

Enumerator
BEGIN_STRING 
BEGIN_NUMBER 
BEGIN_TRUE 
BEGIN_FALSE 
BEGIN_NULL 
BEGIN_OBJECT 
END_OBJECT 
BEGIN_ARRAY 
END_ARRAY 
ENTRY_SEPARATOR 
VALUE_SEPARATOR 
BEGIN_KEY 
UNKNOWN 
BEGIN_STRING 
BEGIN_NUMBER 
BEGIN_TRUE 
BEGIN_FALSE 
BEGIN_NULL 
BEGIN_OBJECT 
END_OBJECT 
BEGIN_ARRAY 
END_ARRAY 
ENTRY_SEPARATOR 
VALUE_SEPARATOR 
BEGIN_KEY 
UNKNOWN 

Definition at line 96 of file bloaty/third_party/protobuf/src/google/protobuf/util/internal/json_stream_parser.h.

◆ TokenType [2/2]

Enumerator
BEGIN_STRING 
BEGIN_NUMBER 
BEGIN_TRUE 
BEGIN_FALSE 
BEGIN_NULL 
BEGIN_OBJECT 
END_OBJECT 
BEGIN_ARRAY 
END_ARRAY 
ENTRY_SEPARATOR 
VALUE_SEPARATOR 
BEGIN_KEY 
UNKNOWN 
BEGIN_STRING 
BEGIN_NUMBER 
BEGIN_TRUE 
BEGIN_FALSE 
BEGIN_NULL 
BEGIN_OBJECT 
END_OBJECT 
BEGIN_ARRAY 
END_ARRAY 
ENTRY_SEPARATOR 
VALUE_SEPARATOR 
BEGIN_KEY 
UNKNOWN 

Definition at line 129 of file protobuf/src/google/protobuf/util/internal/json_stream_parser.h.

Constructor & Destructor Documentation

◆ JsonStreamParser() [1/2]

google::protobuf::util::converter::JsonStreamParser::JsonStreamParser ( ObjectWriter ow)
explicit

◆ ~JsonStreamParser() [1/2]

google::protobuf::util::converter::JsonStreamParser::~JsonStreamParser ( )
virtual

◆ JsonStreamParser() [2/2]

google::protobuf::util::converter::JsonStreamParser::JsonStreamParser ( ObjectWriter ow)
explicit

◆ ~JsonStreamParser() [2/2]

virtual google::protobuf::util::converter::JsonStreamParser::~JsonStreamParser ( )
virtual

Member Function Documentation

◆ Advance() [1/2]

void google::protobuf::util::converter::JsonStreamParser::Advance ( )
private

◆ Advance() [2/2]

void google::protobuf::util::converter::JsonStreamParser::Advance ( )
private

◆ FinishParse() [1/2]

util::Status google::protobuf::util::converter::JsonStreamParser::FinishParse ( )

◆ FinishParse() [2/2]

util::Status google::protobuf::util::converter::JsonStreamParser::FinishParse ( )

◆ GetNextTokenType() [1/2]

JsonStreamParser::TokenType google::protobuf::util::converter::JsonStreamParser::GetNextTokenType ( )
private

◆ GetNextTokenType() [2/2]

TokenType google::protobuf::util::converter::JsonStreamParser::GetNextTokenType ( )
private

◆ GOOGLE_DISALLOW_IMPLICIT_CONSTRUCTORS() [1/2]

google::protobuf::util::converter::JsonStreamParser::GOOGLE_DISALLOW_IMPLICIT_CONSTRUCTORS ( JsonStreamParser  )
private

◆ GOOGLE_DISALLOW_IMPLICIT_CONSTRUCTORS() [2/2]

google::protobuf::util::converter::JsonStreamParser::GOOGLE_DISALLOW_IMPLICIT_CONSTRUCTORS ( JsonStreamParser  )
private

◆ HandleBeginArray() [1/2]

util::Status google::protobuf::util::converter::JsonStreamParser::HandleBeginArray ( )
private

◆ HandleBeginArray() [2/2]

util::Status google::protobuf::util::converter::JsonStreamParser::HandleBeginArray ( )
private

◆ HandleBeginObject() [1/2]

util::Status google::protobuf::util::converter::JsonStreamParser::HandleBeginObject ( )
private

◆ HandleBeginObject() [2/2]

util::Status google::protobuf::util::converter::JsonStreamParser::HandleBeginObject ( )
private

◆ IncrementRecursionDepth() [1/2]

util::Status google::protobuf::util::converter::JsonStreamParser::IncrementRecursionDepth ( StringPiece  key) const
private

◆ IncrementRecursionDepth() [2/2]

util::Status google::protobuf::util::converter::JsonStreamParser::IncrementRecursionDepth ( StringPiece  key) const
private

◆ IsEmptyNullAllowed() [1/2]

bool google::protobuf::util::converter::JsonStreamParser::IsEmptyNullAllowed ( TokenType  type)
private

◆ IsEmptyNullAllowed() [2/2]

bool google::protobuf::util::converter::JsonStreamParser::IsEmptyNullAllowed ( TokenType  type)
private

◆ IsInputAllWhiteSpaces()

bool google::protobuf::util::converter::JsonStreamParser::IsInputAllWhiteSpaces ( TokenType  type)
private

◆ Parse() [1/2]

util::Status google::protobuf::util::converter::JsonStreamParser::Parse ( StringPiece  json)

◆ Parse() [2/2]

util::Status google::protobuf::util::converter::JsonStreamParser::Parse ( StringPiece  json)

◆ ParseArrayMid() [1/2]

util::Status google::protobuf::util::converter::JsonStreamParser::ParseArrayMid ( TokenType  type)
private

◆ ParseArrayMid() [2/2]

util::Status google::protobuf::util::converter::JsonStreamParser::ParseArrayMid ( TokenType  type)
private

◆ ParseArrayValue() [1/2]

util::Status google::protobuf::util::converter::JsonStreamParser::ParseArrayValue ( TokenType  type)
private

◆ ParseArrayValue() [2/2]

util::Status google::protobuf::util::converter::JsonStreamParser::ParseArrayValue ( TokenType  type)
private

◆ ParseChunk() [1/2]

util::Status google::protobuf::util::converter::JsonStreamParser::ParseChunk ( StringPiece  chunk)
private

◆ ParseChunk() [2/2]

util::Status google::protobuf::util::converter::JsonStreamParser::ParseChunk ( StringPiece  json)
private

◆ ParseDoubleHelper() [1/2]

util::Status google::protobuf::util::converter::JsonStreamParser::ParseDoubleHelper ( const std::string &  number,
NumberResult result 
)
private

◆ ParseDoubleHelper() [2/2]

util::Status google::protobuf::util::converter::JsonStreamParser::ParseDoubleHelper ( const std::string &  number,
NumberResult result 
)
private

◆ ParseEmptyNull() [1/2]

util::Status google::protobuf::util::converter::JsonStreamParser::ParseEmptyNull ( )
private

◆ ParseEmptyNull() [2/2]

util::Status google::protobuf::util::converter::JsonStreamParser::ParseEmptyNull ( )
private

◆ ParseEntry() [1/2]

util::Status google::protobuf::util::converter::JsonStreamParser::ParseEntry ( TokenType  type)
private

◆ ParseEntry() [2/2]

util::Status google::protobuf::util::converter::JsonStreamParser::ParseEntry ( TokenType  type)
private

◆ ParseEntryMid() [1/2]

util::Status google::protobuf::util::converter::JsonStreamParser::ParseEntryMid ( TokenType  type)
private

◆ ParseEntryMid() [2/2]

util::Status google::protobuf::util::converter::JsonStreamParser::ParseEntryMid ( TokenType  type)
private

◆ ParseFalse() [1/2]

util::Status google::protobuf::util::converter::JsonStreamParser::ParseFalse ( )
private

◆ ParseFalse() [2/2]

util::Status google::protobuf::util::converter::JsonStreamParser::ParseFalse ( )
private

◆ ParseKey() [1/2]

util::Status google::protobuf::util::converter::JsonStreamParser::ParseKey ( )
private

◆ ParseKey() [2/2]

util::Status google::protobuf::util::converter::JsonStreamParser::ParseKey ( )
private

◆ ParseNull() [1/2]

util::Status google::protobuf::util::converter::JsonStreamParser::ParseNull ( )
private

◆ ParseNull() [2/2]

util::Status google::protobuf::util::converter::JsonStreamParser::ParseNull ( )
private

◆ ParseNumber() [1/2]

util::Status google::protobuf::util::converter::JsonStreamParser::ParseNumber ( )
private

◆ ParseNumber() [2/2]

util::Status google::protobuf::util::converter::JsonStreamParser::ParseNumber ( )
private

◆ ParseNumberHelper() [1/2]

util::Status google::protobuf::util::converter::JsonStreamParser::ParseNumberHelper ( NumberResult result)
private

◆ ParseNumberHelper() [2/2]

util::Status google::protobuf::util::converter::JsonStreamParser::ParseNumberHelper ( NumberResult result)
private

◆ ParseObjectMid() [1/2]

util::Status google::protobuf::util::converter::JsonStreamParser::ParseObjectMid ( TokenType  type)
private

◆ ParseObjectMid() [2/2]

util::Status google::protobuf::util::converter::JsonStreamParser::ParseObjectMid ( TokenType  type)
private

◆ ParseString() [1/2]

util::Status google::protobuf::util::converter::JsonStreamParser::ParseString ( )
private

◆ ParseString() [2/2]

util::Status google::protobuf::util::converter::JsonStreamParser::ParseString ( )
private

◆ ParseStringHelper() [1/2]

util::Status google::protobuf::util::converter::JsonStreamParser::ParseStringHelper ( )
private

◆ ParseStringHelper() [2/2]

util::Status google::protobuf::util::converter::JsonStreamParser::ParseStringHelper ( )
private

◆ ParseTrue() [1/2]

util::Status google::protobuf::util::converter::JsonStreamParser::ParseTrue ( )
private

◆ ParseTrue() [2/2]

util::Status google::protobuf::util::converter::JsonStreamParser::ParseTrue ( )
private

◆ ParseUnicodeEscape() [1/2]

util::Status google::protobuf::util::converter::JsonStreamParser::ParseUnicodeEscape ( )
private

◆ ParseUnicodeEscape() [2/2]

util::Status google::protobuf::util::converter::JsonStreamParser::ParseUnicodeEscape ( )
private

◆ ParseValue() [1/2]

util::Status google::protobuf::util::converter::JsonStreamParser::ParseValue ( TokenType  type)
private

◆ ParseValue() [2/2]

util::Status google::protobuf::util::converter::JsonStreamParser::ParseValue ( TokenType  type)
private

◆ recursion_depth() [1/2]

int google::protobuf::util::converter::JsonStreamParser::recursion_depth ( )
inlineprivate

◆ recursion_depth() [2/2]

int google::protobuf::util::converter::JsonStreamParser::recursion_depth ( )
inlineprivate

◆ ReportFailure() [1/2]

util::Status google::protobuf::util::converter::JsonStreamParser::ReportFailure ( StringPiece  message)
private

◆ ReportFailure() [2/2]

util::Status google::protobuf::util::converter::JsonStreamParser::ReportFailure ( StringPiece  message,
ParseErrorType  parse_code 
)
private

◆ ReportUnknown() [1/2]

util::Status google::protobuf::util::converter::JsonStreamParser::ReportUnknown ( StringPiece  message)
private

◆ ReportUnknown() [2/2]

util::Status google::protobuf::util::converter::JsonStreamParser::ReportUnknown ( StringPiece  message,
ParseErrorType  parse_code 
)
private

◆ RunParser() [1/2]

util::Status google::protobuf::util::converter::JsonStreamParser::RunParser ( )
private

◆ RunParser() [2/2]

util::Status google::protobuf::util::converter::JsonStreamParser::RunParser ( )
private

◆ set_max_recursion_depth() [1/2]

void google::protobuf::util::converter::JsonStreamParser::set_max_recursion_depth ( int  max_depth)
inline

◆ set_max_recursion_depth() [2/2]

void google::protobuf::util::converter::JsonStreamParser::set_max_recursion_depth ( int  max_depth)
inline

◆ SkipWhitespace() [1/2]

void google::protobuf::util::converter::JsonStreamParser::SkipWhitespace ( )
private

◆ SkipWhitespace() [2/2]

void google::protobuf::util::converter::JsonStreamParser::SkipWhitespace ( )
private

Friends And Related Function Documentation

◆ JsonStreamParserTest

Member Data Documentation

◆ allow_empty_null_

bool google::protobuf::util::converter::JsonStreamParser::allow_empty_null_
private

◆ allow_no_root_element_

bool google::protobuf::util::converter::JsonStreamParser::allow_no_root_element_
private

◆ allow_permissive_key_naming_

bool google::protobuf::util::converter::JsonStreamParser::allow_permissive_key_naming_
private

◆ chunk_storage_

std::string google::protobuf::util::converter::JsonStreamParser::chunk_storage_
private

◆ coerce_to_utf8_

bool google::protobuf::util::converter::JsonStreamParser::coerce_to_utf8_
private

◆ finishing_

bool google::protobuf::util::converter::JsonStreamParser::finishing_
private

◆ json_

StringPiece google::protobuf::util::converter::JsonStreamParser::json_
private

◆ key_

StringPiece google::protobuf::util::converter::JsonStreamParser::key_
private

◆ key_storage_

std::string google::protobuf::util::converter::JsonStreamParser::key_storage_
private

◆ leftover_

std::string google::protobuf::util::converter::JsonStreamParser::leftover_
private

◆ loose_float_number_conversion_

bool google::protobuf::util::converter::JsonStreamParser::loose_float_number_conversion_
private

◆ max_recursion_depth_

int google::protobuf::util::converter::JsonStreamParser::max_recursion_depth_
private

◆ ow_

ObjectWriter * google::protobuf::util::converter::JsonStreamParser::ow_
private

◆ p_

StringPiece google::protobuf::util::converter::JsonStreamParser::p_
private

◆ parsed_

StringPiece google::protobuf::util::converter::JsonStreamParser::parsed_
private

◆ parsed_storage_

std::string google::protobuf::util::converter::JsonStreamParser::parsed_storage_
private

◆ recursion_depth_

int google::protobuf::util::converter::JsonStreamParser::recursion_depth_
mutableprivate

◆ seen_non_whitespace_

bool google::protobuf::util::converter::JsonStreamParser::seen_non_whitespace_
private

◆ stack_

std::stack< ParseType > google::protobuf::util::converter::JsonStreamParser::stack_
private

◆ string_open_

char google::protobuf::util::converter::JsonStreamParser::string_open_
private

◆ utf8_replacement_character_

std::string google::protobuf::util::converter::JsonStreamParser::utf8_replacement_character_
private

The documentation for this class was generated from the following files:


grpc
Author(s):
autogenerated on Fri May 16 2025 03:03:29