Zserio C++ runtime library  1.2.0
Built for Zserio 2.16.0
zserio::BasicJsonParser< ALLOC > Class Template Reference

#include <JsonParser.h>

Classes

class  IObserver
 

Public Member Functions

 BasicJsonParser (std::istream &in, IObserver &observer, const ALLOC &allocator=ALLOC())
 
bool parse ()
 
size_t getLine () const
 
size_t getColumn () const
 

Detailed Description

template<typename ALLOC = std::allocator<uint8_t>>
class zserio::BasicJsonParser< ALLOC >

Json Parser.

Parses the JSON on the fly and calls an observer.

Definition at line 18 of file JsonParser.h.

Constructor & Destructor Documentation

◆ BasicJsonParser()

template<typename ALLOC = std::allocator<uint8_t>>
zserio::BasicJsonParser< ALLOC >::BasicJsonParser ( std::istream &  in,
IObserver observer,
const ALLOC &  allocator = ALLOC() 
)
inline

Constructor.

Parameters
inText stream to parse.
observerObserver to use.
allocatorAllocator to use.

Definition at line 109 of file JsonParser.h.

Member Function Documentation

◆ getColumn()

template<typename ALLOC = std::allocator<uint8_t>>
size_t zserio::BasicJsonParser< ALLOC >::getColumn ( ) const
inline

Gets current column number.

Returns
Column number.

Definition at line 152 of file JsonParser.h.

◆ getLine()

template<typename ALLOC = std::allocator<uint8_t>>
size_t zserio::BasicJsonParser< ALLOC >::getLine ( ) const
inline

Gets current line number.

Returns
Line number.

Definition at line 142 of file JsonParser.h.

◆ parse()

template<typename ALLOC = std::allocator<uint8_t>>
bool zserio::BasicJsonParser< ALLOC >::parse ( )
inline

Parses single JSON element from the text stream.

Returns
True when end-of-file is reached, false otherwise (i.e. another JSON element is present).
Exceptions
JsonParserExceptionWhen parsing fails.

Definition at line 120 of file JsonParser.h.


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