Wire Sysio Wire Sysion 1.0.0
Loading...
Searching...
No Matches
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

Enumerator
kInit 
kError 
kHasNull 
kHasBool 
kHasNumber 
kHasString 
kHasKey 
kEnteringObject 
kExitingObject 
kEnteringArray 
kExitingArray 

Definition at line 65 of file lookaheadparser.cpp.

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}
void IterativeParseInit()
Initialize JSON text token-by-token parsing.
Definition reader.h:605
InsituStringStream ss_
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; }

◆ Double()

bool LookaheadParserHandler::Double ( double d)
inline

Definition at line 51 of file lookaheadparser.cpp.

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

◆ EndArray()

bool LookaheadParserHandler::EndArray ( SizeType )
inline

Definition at line 58 of file lookaheadparser.cpp.

58{ st_ = kExitingArray; return true; }

◆ EndObject()

bool LookaheadParserHandler::EndObject ( SizeType )
inline

Definition at line 56 of file lookaheadparser.cpp.

56{ st_ = kExitingObject; return true; }

◆ Int()

bool LookaheadParserHandler::Int ( int i)
inline

Definition at line 47 of file lookaheadparser.cpp.

47{ st_ = kHasNumber; v_.SetInt(i); return true; }

◆ Int64()

bool LookaheadParserHandler::Int64 ( int64_t i)
inline

Definition at line 49 of file lookaheadparser.cpp.

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

◆ 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; }

◆ Null()

bool LookaheadParserHandler::Null ( )
inline

Definition at line 45 of file lookaheadparser.cpp.

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

◆ 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}
bool IterativeParseNext(InputStream &is, Handler &handler)
Parse one token from JSON text.
Definition reader.h:618
bool HasParseError() const
Whether a parse error has occurred in the last parsing.
Definition reader.h:680
static const int parseFlags
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.

57{ st_ = kEnteringArray; return true; }

◆ StartObject()

bool LookaheadParserHandler::StartObject ( )
inline

Definition at line 54 of file lookaheadparser.cpp.

54{ st_ = kEnteringObject; return true; }

◆ 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; }

◆ Uint()

bool LookaheadParserHandler::Uint ( unsigned u)
inline

Definition at line 48 of file lookaheadparser.cpp.

48{ st_ = kHasNumber; v_.SetUint(u); return true; }

◆ Uint64()

bool LookaheadParserHandler::Uint64 ( uint64_t u)
inline

Definition at line 50 of file lookaheadparser.cpp.

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

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: