Arcane  v3.14.10.0
Documentation développeur
Chargement...
Recherche...
Aucune correspondance
Référence du modèle de la classe GenericReader< SourceEncoding, TargetEncoding, StackAllocator >

SAX-style JSON parser. Use Reader for UTF8 encoding and default allocator. Plus de détails...

#include <arcane/utils/internal/json/rapidjson/reader.h>

+ Graphe de collaboration de GenericReader< SourceEncoding, TargetEncoding, StackAllocator >:

Classes

struct  ClearStackOnExit
 
class  NumberStream
 
class  NumberStream< InputStream, false, false >
 
class  NumberStream< InputStream, true, false >
 
class  NumberStream< InputStream, true, true >
 
class  StackStream
 

Types publics

typedef SourceEncoding::Ch Ch
 SourceEncoding character type.
 

Fonctions membres publiques

 GenericReader (StackAllocator *stackAllocator=0, size_t stackCapacity=kDefaultStackCapacity)
 Constructor.
 
template<unsigned parseFlags, typename InputStream , typename Handler >
ParseResult Parse (InputStream &is, Handler &handler)
 Parse JSON text.
 
template<typename InputStream , typename Handler >
ParseResult Parse (InputStream &is, Handler &handler)
 Parse JSON text (with kParseDefaultFlags)
 
void IterativeParseInit ()
 Initialize JSON text token-by-token parsing.
 
template<unsigned parseFlags, typename InputStream , typename Handler >
bool IterativeParseNext (InputStream &is, Handler &handler)
 Parse one token from JSON text.
 
RAPIDJSON_FORCEINLINE bool IterativeParseComplete () const
 Check if token-by-token parsing JSON text is complete.
 
bool HasParseError () const
 Whether a parse error has occurred in the last parsing.
 
ParseErrorCode GetParseErrorCode () const
 Get the ParseErrorCode of last parsing.
 
size_t GetErrorOffset () const
 Get the position of last parsing error in input, 0 otherwise.
 

Fonctions membres protégées

void SetParseError (ParseErrorCode code, size_t offset)
 

Types privés

enum  IterativeParsingState {
  IterativeParsingFinishState = 0 , IterativeParsingErrorState , IterativeParsingStartState , IterativeParsingObjectInitialState ,
  IterativeParsingMemberKeyState , IterativeParsingMemberValueState , IterativeParsingObjectFinishState , IterativeParsingArrayInitialState ,
  IterativeParsingElementState , IterativeParsingArrayFinishState , IterativeParsingValueState , IterativeParsingElementDelimiterState ,
  IterativeParsingMemberDelimiterState , IterativeParsingKeyValueDelimiterState , cIterativeParsingStateCount
}
 
enum  Token {
  LeftBracketToken = 0 , RightBracketToken , LeftCurlyBracketToken , RightCurlyBracketToken ,
  CommaToken , ColonToken , StringToken , FalseToken ,
  TrueToken , NullToken , NumberToken , kTokenCount
}
 

Fonctions membres privées

 GenericReader (const GenericReader &)
 
GenericReaderoperator= (const GenericReader &)
 
void ClearStack ()
 
template<unsigned parseFlags, typename InputStream >
void SkipWhitespaceAndComments (InputStream &is)
 
template<unsigned parseFlags, typename InputStream , typename Handler >
void ParseObject (InputStream &is, Handler &handler)
 
template<unsigned parseFlags, typename InputStream , typename Handler >
void ParseArray (InputStream &is, Handler &handler)
 
template<unsigned parseFlags, typename InputStream , typename Handler >
void ParseNull (InputStream &is, Handler &handler)
 
template<unsigned parseFlags, typename InputStream , typename Handler >
void ParseTrue (InputStream &is, Handler &handler)
 
template<unsigned parseFlags, typename InputStream , typename Handler >
void ParseFalse (InputStream &is, Handler &handler)
 
template<typename InputStream >
unsigned ParseHex4 (InputStream &is, size_t escapeOffset)
 
template<unsigned parseFlags, typename InputStream , typename Handler >
void ParseString (InputStream &is, Handler &handler, bool isKey=false)
 
template<unsigned parseFlags, typename SEncoding , typename TEncoding , typename InputStream , typename OutputStream >
RAPIDJSON_FORCEINLINE void ParseStringToStream (InputStream &is, OutputStream &os)
 
template<unsigned parseFlags, typename InputStream , typename Handler >
void ParseNumber (InputStream &is, Handler &handler)
 
template<unsigned parseFlags, typename InputStream , typename Handler >
void ParseValue (InputStream &is, Handler &handler)
 
RAPIDJSON_FORCEINLINE Token Tokenize (Ch c) const
 
RAPIDJSON_FORCEINLINE IterativeParsingState Predict (IterativeParsingState state, Token token) const
 
template<unsigned parseFlags, typename InputStream , typename Handler >
RAPIDJSON_FORCEINLINE IterativeParsingState Transit (IterativeParsingState src, Token token, IterativeParsingState dst, InputStream &is, Handler &handler)
 
template<typename InputStream >
void HandleError (IterativeParsingState src, InputStream &is)
 
RAPIDJSON_FORCEINLINE bool IsIterativeParsingDelimiterState (IterativeParsingState s) const
 
RAPIDJSON_FORCEINLINE bool IsIterativeParsingCompleteState (IterativeParsingState s) const
 
template<unsigned parseFlags, typename InputStream , typename Handler >
ParseResult IterativeParse (InputStream &is, Handler &handler)
 

Fonctions membres privées statiques

template<typename InputStream >
static RAPIDJSON_FORCEINLINE bool Consume (InputStream &is, typename InputStream::Ch expect)
 
template<typename InputStream , typename OutputStream >
static RAPIDJSON_FORCEINLINE void ScanCopyUnescapedString (InputStream &, OutputStream &)
 

Attributs privés

internal::Stack< StackAllocator > stack_
 A stack for storing decoded string temporarily during non-destructive parsing.
 
ParseResult parseResult_
 
IterativeParsingState state_
 

Attributs privés statiques

static const size_t kDefaultStackCapacity = 256
 Default stack capacity in bytes for storing a single decoded string.
 

Description détaillée

template<typename SourceEncoding, typename TargetEncoding, typename StackAllocator = CrtAllocator>
class GenericReader< SourceEncoding, TargetEncoding, StackAllocator >

SAX-style JSON parser. Use Reader for UTF8 encoding and default allocator.

GenericReader parses JSON text from a stream, and send events synchronously to an object implementing Handler concept.

It needs to allocate a stack for storing a single decoded string during non-destructive parsing.

For in-situ parsing, the decoded string is directly written to the source text string, no temporary buffer is required.

A GenericReader object can be reused for parsing multiple JSON text.

Paramètres du template
SourceEncodingEncoding of the input stream.
TargetEncodingEncoding of the parse output.
StackAllocatorAllocator type for stack.

Définition à la ligne 539 du fichier reader.h.

Documentation des définitions de type membres

◆ Ch

template<typename SourceEncoding , typename TargetEncoding , typename StackAllocator = CrtAllocator>
typedef SourceEncoding::Ch GenericReader< SourceEncoding, TargetEncoding, StackAllocator >::Ch

SourceEncoding character type.

Définition à la ligne 541 du fichier reader.h.

Documentation des énumérations membres

◆ IterativeParsingState

template<typename SourceEncoding , typename TargetEncoding , typename StackAllocator = CrtAllocator>
enum GenericReader::IterativeParsingState
private

Définition à la ligne 1756 du fichier reader.h.

◆ Token

template<typename SourceEncoding , typename TargetEncoding , typename StackAllocator = CrtAllocator>
enum GenericReader::Token
private

Définition à la ligne 1784 du fichier reader.h.

Documentation des constructeurs et destructeur

◆ GenericReader()

template<typename SourceEncoding , typename TargetEncoding , typename StackAllocator = CrtAllocator>
GenericReader< SourceEncoding, TargetEncoding, StackAllocator >::GenericReader ( StackAllocator *  stackAllocator = 0,
size_t  stackCapacity = kDefaultStackCapacity 
)
inline

Constructor.

Paramètres
stackAllocatorOptional allocator for allocating stack memory. (Only use for non-destructive parsing)
stackCapacitystack capacity in bytes for storing a single decoded string. (Only use for non-destructive parsing)

Définition à la ligne 547 du fichier reader.h.

Documentation des fonctions membres

◆ ClearStack()

template<typename SourceEncoding , typename TargetEncoding , typename StackAllocator = CrtAllocator>
void GenericReader< SourceEncoding, TargetEncoding, StackAllocator >::ClearStack ( )
inlineprivate

Définition à la ligne 698 du fichier reader.h.

◆ Consume()

template<typename SourceEncoding , typename TargetEncoding , typename StackAllocator = CrtAllocator>
template<typename InputStream >
static RAPIDJSON_FORCEINLINE bool GenericReader< SourceEncoding, TargetEncoding, StackAllocator >::Consume ( InputStream &  is,
typename InputStream::Ch  expect 
)
inlinestaticprivate

Définition à la ligne 895 du fichier reader.h.

◆ GetErrorOffset()

template<typename SourceEncoding , typename TargetEncoding , typename StackAllocator = CrtAllocator>
size_t GenericReader< SourceEncoding, TargetEncoding, StackAllocator >::GetErrorOffset ( ) const
inline

Get the position of last parsing error in input, 0 otherwise.

Définition à la ligne 688 du fichier reader.h.

Références ParseResult::Offset().

◆ GetParseErrorCode()

template<typename SourceEncoding , typename TargetEncoding , typename StackAllocator = CrtAllocator>
ParseErrorCode GenericReader< SourceEncoding, TargetEncoding, StackAllocator >::GetParseErrorCode ( ) const
inline

Get the ParseErrorCode of last parsing.

Définition à la ligne 685 du fichier reader.h.

Références ParseResult::Code().

◆ HandleError()

template<typename SourceEncoding , typename TargetEncoding , typename StackAllocator = CrtAllocator>
template<typename InputStream >
void GenericReader< SourceEncoding, TargetEncoding, StackAllocator >::HandleError ( IterativeParsingState  src,
InputStream &  is 
)
inlineprivate

Définition à la ligne 2149 du fichier reader.h.

◆ HasParseError()

template<typename SourceEncoding , typename TargetEncoding , typename StackAllocator = CrtAllocator>
bool GenericReader< SourceEncoding, TargetEncoding, StackAllocator >::HasParseError ( ) const
inline

Whether a parse error has occurred in the last parsing.

Définition à la ligne 682 du fichier reader.h.

Références ParseResult::IsError().

◆ IsIterativeParsingCompleteState()

template<typename SourceEncoding , typename TargetEncoding , typename StackAllocator = CrtAllocator>
RAPIDJSON_FORCEINLINE bool GenericReader< SourceEncoding, TargetEncoding, StackAllocator >::IsIterativeParsingCompleteState ( IterativeParsingState  s) const
inlineprivate

Définition à la ligne 2173 du fichier reader.h.

◆ IsIterativeParsingDelimiterState()

template<typename SourceEncoding , typename TargetEncoding , typename StackAllocator = CrtAllocator>
RAPIDJSON_FORCEINLINE bool GenericReader< SourceEncoding, TargetEncoding, StackAllocator >::IsIterativeParsingDelimiterState ( IterativeParsingState  s) const
inlineprivate

Définition à la ligne 2169 du fichier reader.h.

◆ IterativeParse()

template<typename SourceEncoding , typename TargetEncoding , typename StackAllocator = CrtAllocator>
template<unsigned parseFlags, typename InputStream , typename Handler >
ParseResult GenericReader< SourceEncoding, TargetEncoding, StackAllocator >::IterativeParse ( InputStream &  is,
Handler handler 
)
inlineprivate

Définition à la ligne 2178 du fichier reader.h.

◆ IterativeParseComplete()

template<typename SourceEncoding , typename TargetEncoding , typename StackAllocator = CrtAllocator>
RAPIDJSON_FORCEINLINE bool GenericReader< SourceEncoding, TargetEncoding, StackAllocator >::IterativeParseComplete ( ) const
inline

Check if token-by-token parsing JSON text is complete.

Renvoie
Whether the JSON has been fully decoded.

Définition à la ligne 677 du fichier reader.h.

◆ IterativeParseInit()

template<typename SourceEncoding , typename TargetEncoding , typename StackAllocator = CrtAllocator>
void GenericReader< SourceEncoding, TargetEncoding, StackAllocator >::IterativeParseInit ( )
inline

Initialize JSON text token-by-token parsing.

Définition à la ligne 607 du fichier reader.h.

Références ParseResult::Clear().

◆ IterativeParseNext()

template<typename SourceEncoding , typename TargetEncoding , typename StackAllocator = CrtAllocator>
template<unsigned parseFlags, typename InputStream , typename Handler >
bool GenericReader< SourceEncoding, TargetEncoding, StackAllocator >::IterativeParseNext ( InputStream &  is,
Handler handler 
)
inline

Parse one token from JSON text.

Paramètres du template
InputStreamType of input stream, implementing Stream concept
HandlerType of handler, implementing Handler concept.
Paramètres
isInput stream to be parsed.
handlerThe handler to receive events.
Renvoie
Whether the parsing is successful.

Définition à la ligne 620 du fichier reader.h.

Références kParseStopWhenDoneFlag, RAPIDJSON_ASSERT, RAPIDJSON_LIKELY, RAPIDJSON_UNLIKELY, et GenericReader< SourceEncoding, TargetEncoding, StackAllocator >::stack_.

◆ Parse() [1/2]

template<typename SourceEncoding , typename TargetEncoding , typename StackAllocator = CrtAllocator>
template<unsigned parseFlags, typename InputStream , typename Handler >
ParseResult GenericReader< SourceEncoding, TargetEncoding, StackAllocator >::Parse ( InputStream &  is,
Handler handler 
)
inline

Parse JSON text.

Paramètres du template
parseFlagsCombination of ParseFlag.
InputStreamType of input stream, implementing Stream concept.
HandlerType of handler, implementing Handler concept.
Paramètres
isInput stream to be parsed.
handlerThe handler to receive events.
Renvoie
Whether the parsing is successful.

Définition à la ligne 559 du fichier reader.h.

Références ParseResult::Clear(), kParseErrorDocumentEmpty, kParseErrorDocumentRootNotSingular, kParseIterativeFlag, kParseStopWhenDoneFlag, RAPIDJSON_PARSE_ERROR_NORETURN, et RAPIDJSON_UNLIKELY.

◆ Parse() [2/2]

template<typename SourceEncoding , typename TargetEncoding , typename StackAllocator = CrtAllocator>
template<typename InputStream , typename Handler >
ParseResult GenericReader< SourceEncoding, TargetEncoding, StackAllocator >::Parse ( InputStream &  is,
Handler handler 
)
inline

Parse JSON text (with kParseDefaultFlags)

Paramètres du template
InputStreamType of input stream, implementing Stream concept
HandlerType of handler, implementing Handler concept.
Paramètres
isInput stream to be parsed.
handlerThe handler to receive events.
Renvoie
Whether the parsing is successful.

Définition à la ligne 600 du fichier reader.h.

◆ ParseArray()

template<typename SourceEncoding , typename TargetEncoding , typename StackAllocator = CrtAllocator>
template<unsigned parseFlags, typename InputStream , typename Handler >
void GenericReader< SourceEncoding, TargetEncoding, StackAllocator >::ParseArray ( InputStream &  is,
Handler handler 
)
inlineprivate

Définition à la ligne 808 du fichier reader.h.

◆ ParseFalse()

template<typename SourceEncoding , typename TargetEncoding , typename StackAllocator = CrtAllocator>
template<unsigned parseFlags, typename InputStream , typename Handler >
void GenericReader< SourceEncoding, TargetEncoding, StackAllocator >::ParseFalse ( InputStream &  is,
Handler handler 
)
inlineprivate

Définition à la ligne 882 du fichier reader.h.

◆ ParseHex4()

template<typename SourceEncoding , typename TargetEncoding , typename StackAllocator = CrtAllocator>
template<typename InputStream >
unsigned GenericReader< SourceEncoding, TargetEncoding, StackAllocator >::ParseHex4 ( InputStream &  is,
size_t  escapeOffset 
)
inlineprivate

Définition à la ligne 906 du fichier reader.h.

◆ ParseNull()

template<typename SourceEncoding , typename TargetEncoding , typename StackAllocator = CrtAllocator>
template<unsigned parseFlags, typename InputStream , typename Handler >
void GenericReader< SourceEncoding, TargetEncoding, StackAllocator >::ParseNull ( InputStream &  is,
Handler handler 
)
inlineprivate

Définition à la ligne 856 du fichier reader.h.

◆ ParseNumber()

template<typename SourceEncoding , typename TargetEncoding , typename StackAllocator = CrtAllocator>
template<unsigned parseFlags, typename InputStream , typename Handler >
void GenericReader< SourceEncoding, TargetEncoding, StackAllocator >::ParseNumber ( InputStream &  is,
Handler handler 
)
inlineprivate

Définition à la ligne 1456 du fichier reader.h.

◆ ParseObject()

template<typename SourceEncoding , typename TargetEncoding , typename StackAllocator = CrtAllocator>
template<unsigned parseFlags, typename InputStream , typename Handler >
void GenericReader< SourceEncoding, TargetEncoding, StackAllocator >::ParseObject ( InputStream &  is,
Handler handler 
)
inlineprivate

Définition à la ligne 740 du fichier reader.h.

◆ ParseString()

template<typename SourceEncoding , typename TargetEncoding , typename StackAllocator = CrtAllocator>
template<unsigned parseFlags, typename InputStream , typename Handler >
void GenericReader< SourceEncoding, TargetEncoding, StackAllocator >::ParseString ( InputStream &  is,
Handler handler,
bool  isKey = false 
)
inlineprivate

Définition à la ligne 959 du fichier reader.h.

◆ ParseStringToStream()

template<typename SourceEncoding , typename TargetEncoding , typename StackAllocator = CrtAllocator>
template<unsigned parseFlags, typename SEncoding , typename TEncoding , typename InputStream , typename OutputStream >
RAPIDJSON_FORCEINLINE void GenericReader< SourceEncoding, TargetEncoding, StackAllocator >::ParseStringToStream ( InputStream &  is,
OutputStream &  os 
)
inlineprivate

Définition à la ligne 991 du fichier reader.h.

◆ ParseTrue()

template<typename SourceEncoding , typename TargetEncoding , typename StackAllocator = CrtAllocator>
template<unsigned parseFlags, typename InputStream , typename Handler >
void GenericReader< SourceEncoding, TargetEncoding, StackAllocator >::ParseTrue ( InputStream &  is,
Handler handler 
)
inlineprivate

Définition à la ligne 869 du fichier reader.h.

◆ ParseValue()

template<typename SourceEncoding , typename TargetEncoding , typename StackAllocator = CrtAllocator>
template<unsigned parseFlags, typename InputStream , typename Handler >
void GenericReader< SourceEncoding, TargetEncoding, StackAllocator >::ParseValue ( InputStream &  is,
Handler handler 
)
inlineprivate

Définition à la ligne 1738 du fichier reader.h.

◆ Predict()

template<typename SourceEncoding , typename TargetEncoding , typename StackAllocator = CrtAllocator>
RAPIDJSON_FORCEINLINE IterativeParsingState GenericReader< SourceEncoding, TargetEncoding, StackAllocator >::Predict ( IterativeParsingState  state,
Token  token 
) const
inlineprivate

Définition à la ligne 1830 du fichier reader.h.

◆ ScanCopyUnescapedString()

template<typename SourceEncoding , typename TargetEncoding , typename StackAllocator = CrtAllocator>
template<typename InputStream , typename OutputStream >
static RAPIDJSON_FORCEINLINE void GenericReader< SourceEncoding, TargetEncoding, StackAllocator >::ScanCopyUnescapedString ( InputStream &  ,
OutputStream &   
)
inlinestaticprivate

Définition à la ligne 1059 du fichier reader.h.

◆ SetParseError()

template<typename SourceEncoding , typename TargetEncoding , typename StackAllocator = CrtAllocator>
void GenericReader< SourceEncoding, TargetEncoding, StackAllocator >::SetParseError ( ParseErrorCode  code,
size_t  offset 
)
inlineprotected

Définition à la ligne 691 du fichier reader.h.

◆ SkipWhitespaceAndComments()

template<typename SourceEncoding , typename TargetEncoding , typename StackAllocator = CrtAllocator>
template<unsigned parseFlags, typename InputStream >
void GenericReader< SourceEncoding, TargetEncoding, StackAllocator >::SkipWhitespaceAndComments ( InputStream &  is)
inlineprivate

Définition à la ligne 711 du fichier reader.h.

◆ Tokenize()

template<typename SourceEncoding , typename TargetEncoding , typename StackAllocator = CrtAllocator>
RAPIDJSON_FORCEINLINE Token GenericReader< SourceEncoding, TargetEncoding, StackAllocator >::Tokenize ( Ch  c) const
inlineprivate

Définition à la ligne 1803 du fichier reader.h.

◆ Transit()

template<typename SourceEncoding , typename TargetEncoding , typename StackAllocator = CrtAllocator>
template<unsigned parseFlags, typename InputStream , typename Handler >
RAPIDJSON_FORCEINLINE IterativeParsingState GenericReader< SourceEncoding, TargetEncoding, StackAllocator >::Transit ( IterativeParsingState  src,
Token  token,
IterativeParsingState  dst,
InputStream &  is,
Handler handler 
)
inlineprivate

Définition à la ligne 1997 du fichier reader.h.

Documentation des données membres

◆ kDefaultStackCapacity

template<typename SourceEncoding , typename TargetEncoding , typename StackAllocator = CrtAllocator>
const size_t GenericReader< SourceEncoding, TargetEncoding, StackAllocator >::kDefaultStackCapacity = 256
staticprivate

Default stack capacity in bytes for storing a single decoded string.

Définition à la ligne 2212 du fichier reader.h.

◆ parseResult_

template<typename SourceEncoding , typename TargetEncoding , typename StackAllocator = CrtAllocator>
ParseResult GenericReader< SourceEncoding, TargetEncoding, StackAllocator >::parseResult_
private

Définition à la ligne 2214 du fichier reader.h.

◆ stack_

template<typename SourceEncoding , typename TargetEncoding , typename StackAllocator = CrtAllocator>
internal::Stack<StackAllocator> GenericReader< SourceEncoding, TargetEncoding, StackAllocator >::stack_
private

A stack for storing decoded string temporarily during non-destructive parsing.

Définition à la ligne 2213 du fichier reader.h.

Référencé par GenericReader< SourceEncoding, TargetEncoding, StackAllocator >::IterativeParseNext().

◆ state_

template<typename SourceEncoding , typename TargetEncoding , typename StackAllocator = CrtAllocator>
IterativeParsingState GenericReader< SourceEncoding, TargetEncoding, StackAllocator >::state_
private

Définition à la ligne 2215 du fichier reader.h.


La documentation de cette classe a été générée à partir des fichiers suivants :