Electroneum
LookaheadParserHandler Class Reference
Inheritance diagram for LookaheadParserHandler:
Collaboration diagram for LookaheadParserHandler:

Public Member Functions

bool Null ()
 
bool Bool (bool b)
 
bool Int (int i)
 
bool Uint (unsigned u)
 
bool Int64 (int64_t i)
 
bool Uint64 (uint64_t u)
 
bool Double (double d)
 
bool RawNumber (const char *, SizeType, bool)
 
bool String (const char *str, SizeType length, bool)
 
bool StartObject ()
 
bool Key (const char *str, SizeType length, bool)
 
bool EndObject (SizeType)
 
bool StartArray ()
 
bool EndArray (SizeType)
 

Protected Types

enum  LookaheadParsingState {
  kInit, kError, kHasNull, kHasBool,
  kHasNumber, kHasString, kHasKey, kEnteringObject,
  kExitingObject, kEnteringArray, kExitingArray
}
 

Protected Member Functions

 LookaheadParserHandler (char *str)
 
void ParseNext ()
 

Protected Attributes

Value v_
 
LookaheadParsingState st_
 
Reader r_
 
InsituStringStream ss_
 

Static Protected Attributes

static const int parseFlags = kParseDefaultFlags | kParseInsituFlag
 

Detailed Description

Definition at line 43 of file lookaheadparser.cpp.

Member Enumeration Documentation

◆ LookaheadParsingState

Constructor & Destructor Documentation

◆ LookaheadParserHandler()

LookaheadParserHandler::LookaheadParserHandler ( char *  str)
protected

Definition at line 87 of file lookaheadparser.cpp.

87  : v_(), st_(kInit), r_(), ss_(str) {
89  ParseNext();
90 }
InsituStringStream ss_
void IterativeParseInit()
Initialize JSON text token-by-token parsing.
Definition: reader.h:605
LookaheadParsingState st_
Here is the call graph for this function:

Member Function Documentation

◆ Bool()

bool LookaheadParserHandler::Bool ( bool  b)
inline

Definition at line 46 of file lookaheadparser.cpp.

46 { st_ = kHasBool; v_.SetBool(b); return true; }
LookaheadParsingState st_

◆ Double()

bool LookaheadParserHandler::Double ( double  d)
inline

Definition at line 51 of file lookaheadparser.cpp.

51 { st_ = kHasNumber; v_.SetDouble(d); return true; }
LookaheadParsingState st_

◆ EndArray()

bool LookaheadParserHandler::EndArray ( SizeType  )
inline

Definition at line 58 of file lookaheadparser.cpp.

◆ EndObject()

bool LookaheadParserHandler::EndObject ( SizeType  )
inline

Definition at line 56 of file lookaheadparser.cpp.

◆ Int()

bool LookaheadParserHandler::Int ( int  i)
inline

Definition at line 47 of file lookaheadparser.cpp.

◆ Int64()

bool LookaheadParserHandler::Int64 ( int64_t  i)
inline

Definition at line 49 of file lookaheadparser.cpp.

49 { st_ = kHasNumber; v_.SetInt64(i); return true; }
LookaheadParsingState st_

◆ Key()

bool LookaheadParserHandler::Key ( const char *  str,
SizeType  length,
bool   
)
inline

Definition at line 55 of file lookaheadparser.cpp.

55 { st_ = kHasKey; v_.SetString(str, length); return true; }
LookaheadParsingState st_

◆ Null()

bool LookaheadParserHandler::Null ( )
inline

Definition at line 45 of file lookaheadparser.cpp.

45 { st_ = kHasNull; v_.SetNull(); return true; }
LookaheadParsingState st_

◆ ParseNext()

void LookaheadParserHandler::ParseNext ( )
protected

Definition at line 92 of file lookaheadparser.cpp.

92  {
93  if (r_.HasParseError()) {
94  st_ = kError;
95  return;
96  }
97 
99 }
InsituStringStream ss_
static const int parseFlags
bool HasParseError() const
Whether a parse error has occurred in the last parsing.
Definition: reader.h:680
bool IterativeParseNext(InputStream &is, Handler &handler)
Parse one token from JSON text.
Definition: reader.h:618
LookaheadParsingState st_
Here is the call graph for this function:
Here is the caller graph for this function:

◆ RawNumber()

bool LookaheadParserHandler::RawNumber ( const char *  ,
SizeType  ,
bool   
)
inline

Definition at line 52 of file lookaheadparser.cpp.

52 { return false; }

◆ StartArray()

bool LookaheadParserHandler::StartArray ( )
inline

Definition at line 57 of file lookaheadparser.cpp.

◆ StartObject()

bool LookaheadParserHandler::StartObject ( )
inline

Definition at line 54 of file lookaheadparser.cpp.

◆ String()

bool LookaheadParserHandler::String ( const char *  str,
SizeType  length,
bool   
)
inline

Definition at line 53 of file lookaheadparser.cpp.

53 { st_ = kHasString; v_.SetString(str, length); return true; }
LookaheadParsingState st_

◆ Uint()

bool LookaheadParserHandler::Uint ( unsigned  u)
inline

Definition at line 48 of file lookaheadparser.cpp.

◆ Uint64()

bool LookaheadParserHandler::Uint64 ( uint64_t  u)
inline

Definition at line 50 of file lookaheadparser.cpp.

50 { st_ = kHasNumber; v_.SetUint64(u); return true; }
LookaheadParsingState st_

Member Data Documentation

◆ parseFlags

const int LookaheadParserHandler::parseFlags = kParseDefaultFlags | kParseInsituFlag
staticprotected

Definition at line 84 of file lookaheadparser.cpp.

◆ r_

Reader LookaheadParserHandler::r_
protected

Definition at line 81 of file lookaheadparser.cpp.

◆ ss_

InsituStringStream LookaheadParserHandler::ss_
protected

Definition at line 82 of file lookaheadparser.cpp.

◆ st_

LookaheadParsingState LookaheadParserHandler::st_
protected

Definition at line 80 of file lookaheadparser.cpp.

◆ v_

Value LookaheadParserHandler::v_
protected

Definition at line 79 of file lookaheadparser.cpp.


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