All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Private Attributes | List of all members
nlohmann::detail::input_stream_adapter Class Reference

#include <json.hpp>

Inheritance diagram for nlohmann::detail::input_stream_adapter:
nlohmann::detail::input_adapter_protocol

Public Member Functions

 ~input_stream_adapter () override
 
 input_stream_adapter (std::istream &i)
 
 input_stream_adapter (const input_stream_adapter &)=delete
 
input_stream_adapteroperator= (input_stream_adapter &)=delete
 
 input_stream_adapter (input_stream_adapter &&)=delete
 
input_stream_adapteroperator= (input_stream_adapter &&)=delete
 
std::char_traits< char >::int_type get_character () override
 get a character [0,255] or std::char_traits<char>::eof(). More...
 
- Public Member Functions inherited from nlohmann::detail::input_adapter_protocol
virtual ~input_adapter_protocol ()=default
 

Private Attributes

std::istream & is
 the associated input stream More...
 
std::streambuf & sb
 

Detailed Description

Input adapter for a (caching) istream. Ignores a UFT Byte Order Mark at beginning of input. Does not support changing the underlying std::streambuf in mid-input. Maintains underlying std::istream and std::streambuf to support subsequent use of standard std::istream operations to process any input characters following those used in parsing the JSON input. Clears the std::istream flags; any input errors (e.g., EOF) will be detected by the first subsequent call for input from the std::istream.

Definition at line 3953 of file json.hpp.

Constructor & Destructor Documentation

nlohmann::detail::input_stream_adapter::~input_stream_adapter ( )
inlineoverride

Definition at line 3956 of file json.hpp.

3957  {
3958  // clear stream flags; we use underlying streambuf I/O, do not
3959  // maintain ifstream flags, except eof
3960  is.clear(is.rdstate() & std::ios::eofbit);
3961  }
std::istream & is
the associated input stream
Definition: json.hpp:3989
nlohmann::detail::input_stream_adapter::input_stream_adapter ( std::istream &  i)
inlineexplicit

Definition at line 3963 of file json.hpp.

3964  : is(i), sb(*i.rdbuf())
3965  {}
std::istream & is
the associated input stream
Definition: json.hpp:3989
nlohmann::detail::input_stream_adapter::input_stream_adapter ( const input_stream_adapter )
delete
nlohmann::detail::input_stream_adapter::input_stream_adapter ( input_stream_adapter &&  )
delete

Member Function Documentation

std::char_traits<char>::int_type nlohmann::detail::input_stream_adapter::get_character ( )
inlineoverridevirtual

get a character [0,255] or std::char_traits<char>::eof().

Implements nlohmann::detail::input_adapter_protocol.

Definition at line 3976 of file json.hpp.

3977  {
3978  auto res = sb.sbumpc();
3979  // set eof manually, as we don't use the istream interface.
3980  if (res == EOF)
3981  {
3982  is.clear(is.rdstate() | std::ios::eofbit);
3983  }
3984  return res;
3985  }
std::istream & is
the associated input stream
Definition: json.hpp:3989
input_stream_adapter& nlohmann::detail::input_stream_adapter::operator= ( input_stream_adapter )
delete
input_stream_adapter& nlohmann::detail::input_stream_adapter::operator= ( input_stream_adapter &&  )
delete

Member Data Documentation

std::istream& nlohmann::detail::input_stream_adapter::is
private

the associated input stream

Definition at line 3989 of file json.hpp.

std::streambuf& nlohmann::detail::input_stream_adapter::sb
private

Definition at line 3990 of file json.hpp.


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