pjson 1.0.0
A small, owning JSON value for C++11
Loading...
Searching...
No Matches
ByteDance::pjson::SaxHandler Struct Reference

Event sink for non-owning SAX parsing. Return false from any callback to cancel parsing; public parseSax* APIs return false for cancellation or thrown exceptions and populate ParseError when one is supplied. More...

#include <pjson.h>

Public Member Functions

virtual ~SaxHandler ()
 Public API member ~SaxHandler; see the API overview for its contract. / Receives a JSON null value; return false to cancel parsing.
 
virtual bool onNull ()
 Public API member onNull; see the API overview for its contract. / Receives a JSON boolean value; return false to cancel parsing.
 
virtual bool onBool (bool aValue)
 Public API member onBool; see the API overview for its contract. / Receives an integer-valued JSON number; return false to cancel parsing.
 
virtual bool onInt (int64_t aValue)
 Public API member onInt; see the API overview for its contract. / Receives a floating-point JSON number; return false to cancel parsing.
 
virtual bool onDouble (double aValue)
 Public API member onDouble; see the API overview for its contract. / Receives borrowed decoded string bytes; return false to cancel parsing.
 
virtual bool onString (const std::string &aValue)
 Public API member onString; see the API overview for its contract. / Marks the beginning of an array; return false to cancel parsing.
 
virtual bool onStartArray ()
 Public API member onStartArray; see the API overview for its contract. / Marks the end of an array; return false to cancel parsing.
 
virtual bool onEndArray ()
 Public API member onEndArray; see the API overview for its contract. / Marks the beginning of an object; return false to cancel parsing.
 
virtual bool onStartObject ()
 Public API member onStartObject; see the API overview for its contract. / Receives a borrowed decoded object key; return false to cancel parsing.
 
virtual bool onKey (const std::string &aKey)
 Public API member onKey; see the API overview for its contract. / Marks the end of an object; return false to cancel parsing.
 
virtual bool onEndObject ()
 Public API member onEndObject; see the API overview for its contract.
 

Detailed Description

Event sink for non-owning SAX parsing. Return false from any callback to cancel parsing; public parseSax* APIs return false for cancellation or thrown exceptions and populate ParseError when one is supplied.

Callbacks are delivered in source order. Duplicate-key policy still applies: RejectDuplicateKeys fails on the duplicate key, KeepFirstDuplicate suppresses later duplicate-value subtrees, and KeepLastDuplicate accepts duplicates while still reporting both occurrences because a streaming SAX walk cannot retract prior events. String and key references are borrowed and remain valid only for the duration of their callback. The handler itself need only outlive the parseSax* call. Default callbacks accept the event and do nothing.

Definition at line 271 of file pjson.h.

Constructor & Destructor Documentation

◆ ~SaxHandler()

virtual ByteDance::pjson::SaxHandler::~SaxHandler ( )
virtual

Public API member ~SaxHandler; see the API overview for its contract. / Receives a JSON null value; return false to cancel parsing.

Member Function Documentation

◆ onBool()

virtual bool ByteDance::pjson::SaxHandler::onBool ( bool  aValue)
virtual

Public API member onBool; see the API overview for its contract. / Receives an integer-valued JSON number; return false to cancel parsing.

◆ onDouble()

virtual bool ByteDance::pjson::SaxHandler::onDouble ( double  aValue)
virtual

Public API member onDouble; see the API overview for its contract. / Receives borrowed decoded string bytes; return false to cancel parsing.

◆ onEndArray()

virtual bool ByteDance::pjson::SaxHandler::onEndArray ( )
virtual

Public API member onEndArray; see the API overview for its contract. / Marks the beginning of an object; return false to cancel parsing.

◆ onEndObject()

virtual bool ByteDance::pjson::SaxHandler::onEndObject ( )
virtual

Public API member onEndObject; see the API overview for its contract.

◆ onInt()

virtual bool ByteDance::pjson::SaxHandler::onInt ( int64_t  aValue)
virtual

Public API member onInt; see the API overview for its contract. / Receives a floating-point JSON number; return false to cancel parsing.

◆ onKey()

virtual bool ByteDance::pjson::SaxHandler::onKey ( const std::string &  aKey)
virtual

Public API member onKey; see the API overview for its contract. / Marks the end of an object; return false to cancel parsing.

◆ onNull()

virtual bool ByteDance::pjson::SaxHandler::onNull ( )
virtual

Public API member onNull; see the API overview for its contract. / Receives a JSON boolean value; return false to cancel parsing.

◆ onStartArray()

virtual bool ByteDance::pjson::SaxHandler::onStartArray ( )
virtual

Public API member onStartArray; see the API overview for its contract. / Marks the end of an array; return false to cancel parsing.

◆ onStartObject()

virtual bool ByteDance::pjson::SaxHandler::onStartObject ( )
virtual

Public API member onStartObject; see the API overview for its contract. / Receives a borrowed decoded object key; return false to cancel parsing.

◆ onString()

virtual bool ByteDance::pjson::SaxHandler::onString ( const std::string &  aValue)
virtual

Public API member onString; see the API overview for its contract. / Marks the beginning of an array; return false to cancel parsing.


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