ChessPlusPlus  WIP
cplusplus.com Community Project
chesspp::util::JsonReader Class Reference

#include <JsonReader.hpp>

Classes

class  NestedValue
 

Public Member Functions

 JsonReader ()=delete
 
 JsonReader (JsonReader const &)=delete
 
JsonReaderoperator= (JsonReader const &)=delete
 
 JsonReader (std::istream &s)
 
 JsonReader (std::istream &&s)
 
 JsonReader (JsonReader &&from)
 
JsonReaderoperator= (std::istream &&s)
 
JsonReaderoperator= (JsonReader &&from)
 
 ~JsonReader ()
 
NestedValue access () const noexcept
 
NestedValue operator() () const noexcept
 
template<typename... Args>
NestedValue navigate (Args...path) const
 

Detailed Description

Respresents an immutable JSON file in memory. Current implementation uses json-parser by James McLaughlin. Thus, it wraps a json_value.

Constructor & Destructor Documentation

chesspp::util::JsonReader::JsonReader ( )
delete
chesspp::util::JsonReader::JsonReader ( JsonReader const &  )
delete
chesspp::util::JsonReader::JsonReader ( std::istream &  s)
inline

Constructs this JsonReader from the given stream. The stream is read to EOF.

Parameters
sThe stream containing the JSON.
chesspp::util::JsonReader::JsonReader ( std::istream &&  s)
inline

Constructs this JsonReader from the given temporary stream. The stream is read to EOF.

Parameters
sThe temporary stream containing the JSON.
chesspp::util::JsonReader::JsonReader ( JsonReader &&  from)
inline

Move-constructs this JsonReader from another.

Parameters
fromthe JsonReader to move.
chesspp::util::JsonReader::~JsonReader ( )
inline

Destructs this JsonReader freeing any allocated memory.

Member Function Documentation

NestedValue chesspp::util::JsonReader::access ( ) const
inlinenoexcept

Returns a NestedValue view into this JSON.

Returns
a NestedValue view into this JSON.
template<typename... Args>
NestedValue chesspp::util::JsonReader::navigate ( Args...  path) const
inline

Navigates through obejct values and array values and returns a NestedValue at the destination.

Template Parameters
ArgsThe types for navigation, generally deduced by the compiler.
Parameters
pathThe path to take to arrive at the destination. May be strings and indicies.
NestedValue chesspp::util::JsonReader::operator() ( ) const
inlinenoexcept

Returns a NestedValue view into this JSON.

Returns
a NestedValue view into this JSON.
JsonReader& chesspp::util::JsonReader::operator= ( JsonReader const &  )
delete
JsonReader& chesspp::util::JsonReader::operator= ( std::istream &&  s)
inline

Move-assigns this JsonReader from a given stream rvalue. The stream is read to EOF. Returns *this

Parameters
sThe stream containing the JSON.
JsonReader& chesspp::util::JsonReader::operator= ( JsonReader &&  from)
inline

Move-assigns this JsonReader from another.

Parameters
fromthe JsonReader to move.

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