cesium-native 0.63.0
Loading...
Searching...
No Matches
CesiumJsonReader::ArrayJsonHandler< T, THandler > Class Template Reference

IJsonHandler for reading a JSON array into an std::vector. More...

#include <CesiumJsonReader/ArrayJsonHandler.h>

Inheritance diagram for CesiumJsonReader::ArrayJsonHandler< T, THandler >:
CesiumJsonReader::JsonHandler CesiumJsonReader::IJsonHandler

Public Types

using ValueType = std::vector<T>
 The destination type.
 

Public Member Functions

template<typename... Ts>
 ArrayJsonHandler (Ts &&... args) noexcept
 Creates a new ArrayJsonHandler.
 
void reset (IJsonHandler *pParent, std::vector< T > *pArray)
 Resets the parent and destination array of this ArrayJsonHandler.
 
virtual IJsonHandlerreadNull () override
 Called when the JSON parser encounters a null.
 
virtual IJsonHandlerreadBool (bool b) override
 Called when the JSON parser encounters a boolean value.
 
virtual IJsonHandlerreadInt32 (int32_t i) override
 Called when the JSON parser encounters an int32 value.
 
virtual IJsonHandlerreadUint32 (uint32_t i) override
 Called when the JSON parser encounters a uint32 value.
 
virtual IJsonHandlerreadInt64 (int64_t i) override
 Called when the JSON parser encounters an int64 value.
 
virtual IJsonHandlerreadUint64 (uint64_t i) override
 Called when the JSON parser encounters a uint64 value.
 
virtual IJsonHandlerreadDouble (double d) override
 Called when the JSON parser encounters a double value.
 
virtual IJsonHandlerreadString (const std::string_view &str) override
 Called when the JSON parser encounters a string value.
 
virtual IJsonHandlerreadObjectStart () override
 Called when the JSON parser encounters the beginning of an object.
 
virtual IJsonHandlerreadObjectKey (const std::string_view &str) noexcept override
 Called when the JSON parser encounters a key while reading an object.
 
virtual IJsonHandlerreadObjectEnd () noexcept override
 Called when the JSON parser encounters the end of an object.
 
virtual IJsonHandlerreadArrayStart () override
 Called when the JSON parser encounters the start of an array.
 
virtual IJsonHandlerreadArrayEnd () override
 Called when the JSON parser encounters the end of an array.
 
virtual void reportWarning (const std::string &warning, std::vector< std::string > &&context=std::vector< std::string >()) override
 Report a warning while reading JSON.
 

Additional Inherited Members

- Protected Member Functions inherited from CesiumJsonReader::JsonHandler
void reset (IJsonHandler *pParent)
 Resets the parent IJsonHandler of this handler.
 
IJsonHandlerparent ()
 Obtains the parent IJsonHandler of this handler.
 
IJsonHandlerignoreAndReturnToParent ()
 Ignore a single value and then return to the parent handler.
 
IJsonHandlerignoreAndContinue ()
 Ignore a single value and the continue processing more tokens with this handler.
 

Detailed Description

template<typename T, typename THandler>
class CesiumJsonReader::ArrayJsonHandler< T, THandler >

IJsonHandler for reading a JSON array into an std::vector.

Template Parameters
TThe element type of the destination vector.
THandlerThe IJsonHandler to handle each element.

Definition at line 24 of file ArrayJsonHandler.h.

Member Typedef Documentation

◆ ValueType

template<typename T, typename THandler>
using CesiumJsonReader::ArrayJsonHandler< T, THandler >::ValueType = std::vector<T>

The destination type.

Definition at line 27 of file ArrayJsonHandler.h.

Constructor & Destructor Documentation

◆ ArrayJsonHandler()

template<typename T, typename THandler>
template<typename... Ts>
CesiumJsonReader::ArrayJsonHandler< T, THandler >::ArrayJsonHandler ( Ts &&... args)
inlinenoexcept

Creates a new ArrayJsonHandler.

Parameters
argsThe arguments that will be passed to the constructor of THandler when it's instantiated.

Definition at line 36 of file ArrayJsonHandler.h.

Member Function Documentation

◆ readArrayEnd()

template<typename T, typename THandler>
virtual IJsonHandler * CesiumJsonReader::ArrayJsonHandler< T, THandler >::readArrayEnd ( )
inlineoverridevirtual

Called when the JSON parser encounters the end of an array.

Returns
A IJsonHandler that will handle the next read... call. This can be the same handler as the current one.

Reimplemented from CesiumJsonReader::JsonHandler.

Definition at line 113 of file ArrayJsonHandler.h.

◆ readArrayStart()

template<typename T, typename THandler>
virtual IJsonHandler * CesiumJsonReader::ArrayJsonHandler< T, THandler >::readArrayStart ( )
inlineoverridevirtual

Called when the JSON parser encounters the start of an array.

Returns
A IJsonHandler that will handle the next read... call. This can be the same handler as the current one.

Reimplemented from CesiumJsonReader::JsonHandler.

Definition at line 103 of file ArrayJsonHandler.h.

◆ readBool()

template<typename T, typename THandler>
virtual IJsonHandler * CesiumJsonReader::ArrayJsonHandler< T, THandler >::readBool ( bool b)
inlineoverridevirtual

Called when the JSON parser encounters a boolean value.

Parameters
bThe boolean value.
Returns
A IJsonHandler that will handle the next read... call. This can be the same handler as the current one.

Reimplemented from CesiumJsonReader::JsonHandler.

Definition at line 57 of file ArrayJsonHandler.h.

◆ readDouble()

template<typename T, typename THandler>
virtual IJsonHandler * CesiumJsonReader::ArrayJsonHandler< T, THandler >::readDouble ( double d)
inlineoverridevirtual

Called when the JSON parser encounters a double value.

Parameters
dThe double value.
Returns
A IJsonHandler that will handle the next read... call. This can be the same handler as the current one.

Reimplemented from CesiumJsonReader::JsonHandler.

Definition at line 77 of file ArrayJsonHandler.h.

◆ readInt32()

template<typename T, typename THandler>
virtual IJsonHandler * CesiumJsonReader::ArrayJsonHandler< T, THandler >::readInt32 ( int32_t i)
inlineoverridevirtual

Called when the JSON parser encounters an int32 value.

Parameters
iThe int32 value.
Returns
A IJsonHandler that will handle the next read... call. This can be the same handler as the current one.

Reimplemented from CesiumJsonReader::JsonHandler.

Definition at line 61 of file ArrayJsonHandler.h.

◆ readInt64()

template<typename T, typename THandler>
virtual IJsonHandler * CesiumJsonReader::ArrayJsonHandler< T, THandler >::readInt64 ( int64_t i)
inlineoverridevirtual

Called when the JSON parser encounters an int64 value.

Parameters
iThe int64 value.
Returns
A IJsonHandler that will handle the next read... call. This can be the same handler as the current one.

Reimplemented from CesiumJsonReader::JsonHandler.

Definition at line 69 of file ArrayJsonHandler.h.

◆ readNull()

template<typename T, typename THandler>
virtual IJsonHandler * CesiumJsonReader::ArrayJsonHandler< T, THandler >::readNull ( )
inlineoverridevirtual

Called when the JSON parser encounters a null.

Returns
A IJsonHandler that will handle the next read... call. This can be the same handler as the current one.

Reimplemented from CesiumJsonReader::JsonHandler.

Definition at line 53 of file ArrayJsonHandler.h.

◆ readObjectEnd()

template<typename T, typename THandler>
virtual IJsonHandler * CesiumJsonReader::ArrayJsonHandler< T, THandler >::readObjectEnd ( )
inlineoverridevirtualnoexcept

Called when the JSON parser encounters the end of an object.

Returns
A IJsonHandler that will handle the next read... call. This can be the same handler as the current one.

Reimplemented from CesiumJsonReader::JsonHandler.

Definition at line 101 of file ArrayJsonHandler.h.

◆ readObjectKey()

template<typename T, typename THandler>
virtual IJsonHandler * CesiumJsonReader::ArrayJsonHandler< T, THandler >::readObjectKey ( const std::string_view & str)
inlineoverridevirtualnoexcept

Called when the JSON parser encounters a key while reading an object.

Parameters
strThe key.
Returns
A IJsonHandler that will handle the next read... call. This can be the same handler as the current one.

Reimplemented from CesiumJsonReader::JsonHandler.

Definition at line 96 of file ArrayJsonHandler.h.

◆ readObjectStart()

template<typename T, typename THandler>
virtual IJsonHandler * CesiumJsonReader::ArrayJsonHandler< T, THandler >::readObjectStart ( )
inlineoverridevirtual

Called when the JSON parser encounters the beginning of an object.

Returns
A IJsonHandler that will handle the next read... call. This can be the same handler as the current one.

Reimplemented from CesiumJsonReader::JsonHandler.

Definition at line 85 of file ArrayJsonHandler.h.

◆ readString()

template<typename T, typename THandler>
virtual IJsonHandler * CesiumJsonReader::ArrayJsonHandler< T, THandler >::readString ( const std::string_view & str)
inlineoverridevirtual

Called when the JSON parser encounters a string value.

Parameters
strThe string value.
Returns
A IJsonHandler that will handle the next read... call. This can be the same handler as the current one.

Reimplemented from CesiumJsonReader::JsonHandler.

Definition at line 81 of file ArrayJsonHandler.h.

◆ readUint32()

template<typename T, typename THandler>
virtual IJsonHandler * CesiumJsonReader::ArrayJsonHandler< T, THandler >::readUint32 ( uint32_t i)
inlineoverridevirtual

Called when the JSON parser encounters a uint32 value.

Parameters
iThe uint32 value.
Returns
A IJsonHandler that will handle the next read... call. This can be the same handler as the current one.

Reimplemented from CesiumJsonReader::JsonHandler.

Definition at line 65 of file ArrayJsonHandler.h.

◆ readUint64()

template<typename T, typename THandler>
virtual IJsonHandler * CesiumJsonReader::ArrayJsonHandler< T, THandler >::readUint64 ( uint64_t i)
inlineoverridevirtual

Called when the JSON parser encounters a uint64 value.

Parameters
iThe uint64 value.
Returns
A IJsonHandler that will handle the next read... call. This can be the same handler as the current one.

Reimplemented from CesiumJsonReader::JsonHandler.

Definition at line 73 of file ArrayJsonHandler.h.

◆ reportWarning()

template<typename T, typename THandler>
virtual void CesiumJsonReader::ArrayJsonHandler< T, THandler >::reportWarning ( const std::string & warning,
std::vector< std::string > && context = std::vector< std::string >() )
inlineoverridevirtual

Report a warning while reading JSON.

Parameters
warningThe warning to report.
contextContext information to include with this warning to help debugging.

Reimplemented from CesiumJsonReader::JsonHandler.

Definition at line 115 of file ArrayJsonHandler.h.

◆ reset()

template<typename T, typename THandler>
void CesiumJsonReader::ArrayJsonHandler< T, THandler >::reset ( IJsonHandler * pParent,
std::vector< T > * pArray )
inline

Resets the parent and destination array of this ArrayJsonHandler.

Definition at line 46 of file ArrayJsonHandler.h.


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