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

#include <json.hpp>

Public Member Functions

 input_adapter (std::FILE *file)
 
 input_adapter (std::istream &i)
 input adapter for input stream More...
 
 input_adapter (std::istream &&i)
 input adapter for input stream More...
 
 input_adapter (const std::wstring &ws)
 
 input_adapter (const std::u16string &ws)
 
 input_adapter (const std::u32string &ws)
 
template<typename CharT , typename std::enable_if< std::is_pointer< CharT >::value andstd::is_integral< typename std::remove_pointer< CharT >::type >::value andsizeof(typename std::remove_pointer< CharT >::type)==1, int >::type = 0>
 input_adapter (CharT b, std::size_t l)
 input adapter for buffer More...
 
template<typename CharT , typename std::enable_if< std::is_pointer< CharT >::value andstd::is_integral< typename std::remove_pointer< CharT >::type >::value andsizeof(typename std::remove_pointer< CharT >::type)==1, int >::type = 0>
 input_adapter (CharT b)
 input adapter for string literal More...
 
template<class IteratorType , typename std::enable_if< std::is_same< typename iterator_traits< IteratorType >::iterator_category, std::random_access_iterator_tag >::value, int >::type = 0>
 input_adapter (IteratorType first, IteratorType last)
 input adapter for iterator range with contiguous storage More...
 
template<class T , std::size_t N>
 std::end (array))
 
template<class ContiguousContainer , typename std::enable_if< not std::is_pointer< ContiguousContainer >::value andstd::is_base_of< std::random_access_iterator_tag, typename iterator_traits< decltype(std::begin(std::declval< ContiguousContainer const >()))>::iterator_category >::value, int >::type = 0>
 input_adapter (const ContiguousContainer &c)
 input adapter for contiguous container More...
 
 operator input_adapter_t ()
 

Public Attributes

template<class T , std::size_t N>
 __pad0__: input_adapter(std::begin(array)
 input adapter for array More...
 

Private Attributes

input_adapter_t ia = nullptr
 the actual adapter More...
 

Detailed Description

Definition at line 4197 of file json.hpp.

Constructor & Destructor Documentation

nlohmann::detail::input_adapter::input_adapter ( std::FILE *  file)
inline

Definition at line 4202 of file json.hpp.

4203  : ia(std::make_shared<file_input_adapter>(file)) {}
* file
Definition: file_to_url.sh:69
input_adapter_t ia
the actual adapter
Definition: json.hpp:4302
nlohmann::detail::input_adapter::input_adapter ( std::istream &  i)
inline

input adapter for input stream

Definition at line 4205 of file json.hpp.

4206  : ia(std::make_shared<input_stream_adapter>(i)) {}
input_adapter_t ia
the actual adapter
Definition: json.hpp:4302
nlohmann::detail::input_adapter::input_adapter ( std::istream &&  i)
inline

input adapter for input stream

Definition at line 4209 of file json.hpp.

4210  : ia(std::make_shared<input_stream_adapter>(i)) {}
input_adapter_t ia
the actual adapter
Definition: json.hpp:4302
nlohmann::detail::input_adapter::input_adapter ( const std::wstring &  ws)
inline

Definition at line 4212 of file json.hpp.

4213  : ia(std::make_shared<wide_string_input_adapter<std::wstring>>(ws)) {}
input_adapter_t ia
the actual adapter
Definition: json.hpp:4302
nlohmann::detail::input_adapter::input_adapter ( const std::u16string &  ws)
inline

Definition at line 4215 of file json.hpp.

4216  : ia(std::make_shared<wide_string_input_adapter<std::u16string>>(ws)) {}
input_adapter_t ia
the actual adapter
Definition: json.hpp:4302
nlohmann::detail::input_adapter::input_adapter ( const std::u32string &  ws)
inline

Definition at line 4218 of file json.hpp.

4219  : ia(std::make_shared<wide_string_input_adapter<std::u32string>>(ws)) {}
input_adapter_t ia
the actual adapter
Definition: json.hpp:4302
template<typename CharT , typename std::enable_if< std::is_pointer< CharT >::value andstd::is_integral< typename std::remove_pointer< CharT >::type >::value andsizeof(typename std::remove_pointer< CharT >::type)==1, int >::type = 0>
nlohmann::detail::input_adapter::input_adapter ( CharT  b,
std::size_t  l 
)
inline

input adapter for buffer

Definition at line 4228 of file json.hpp.

4229  : ia(std::make_shared<input_buffer_adapter>(reinterpret_cast<const char*>(b), l)) {}
input_adapter_t ia
the actual adapter
Definition: json.hpp:4302
template<typename CharT , typename std::enable_if< std::is_pointer< CharT >::value andstd::is_integral< typename std::remove_pointer< CharT >::type >::value andsizeof(typename std::remove_pointer< CharT >::type)==1, int >::type = 0>
nlohmann::detail::input_adapter::input_adapter ( CharT  b)
inline

input adapter for string literal

Definition at line 4240 of file json.hpp.

4241  : input_adapter(reinterpret_cast<const char*>(b),
4242  std::strlen(reinterpret_cast<const char*>(b))) {}
input_adapter(std::FILE *file)
Definition: json.hpp:4202
template<class IteratorType , typename std::enable_if< std::is_same< typename iterator_traits< IteratorType >::iterator_category, std::random_access_iterator_tag >::value, int >::type = 0>
nlohmann::detail::input_adapter::input_adapter ( IteratorType  first,
IteratorType  last 
)
inline

input adapter for iterator range with contiguous storage

Definition at line 4249 of file json.hpp.

4250  {
4251 #ifndef NDEBUG
4252  // assertion to check that the iterator range is indeed contiguous,
4253  // see http://stackoverflow.com/a/35008842/266378 for more discussion
4254  const auto is_contiguous = std::accumulate(
4255  first, last, std::pair<bool, int>(true, 0),
4256  [&first](std::pair<bool, int> res, decltype(*first) val)
4257  {
4258  res.first &= (val == *(std::next(std::addressof(*first), res.second++)));
4259  return res;
4260  }).first;
4261  assert(is_contiguous);
4262 #endif
4263 
4264  // assertion to check that each element is 1 byte long
4265  static_assert(
4266  sizeof(typename iterator_traits<IteratorType>::value_type) == 1,
4267  "each element in the iterator range must have the size of 1 byte");
4268 
4269  const auto len = static_cast<size_t>(std::distance(first, last));
4270  if (JSON_HEDLEY_LIKELY(len > 0))
4271  {
4272  // there is at least one element: use the address of first
4273  ia = std::make_shared<input_buffer_adapter>(reinterpret_cast<const char*>(&(*first)), len);
4274  }
4275  else
4276  {
4277  // the address of first cannot be used: use nullptr
4278  ia = std::make_shared<input_buffer_adapter>(nullptr, len);
4279  }
4280  }
double distance(geo::Point_t const &point, CathodeDesc_t const &cathode)
Returns the distance of a point from the cathode.
#define JSON_HEDLEY_LIKELY(expr)
Definition: json.hpp:1123
input_adapter_t ia
the actual adapter
Definition: json.hpp:4302
template<class ContiguousContainer , typename std::enable_if< not std::is_pointer< ContiguousContainer >::value andstd::is_base_of< std::random_access_iterator_tag, typename iterator_traits< decltype(std::begin(std::declval< ContiguousContainer const >()))>::iterator_category >::value, int >::type = 0>
nlohmann::detail::input_adapter::input_adapter ( const ContiguousContainer &  c)
inline

input adapter for contiguous container

Definition at line 4292 of file json.hpp.

4293  : input_adapter(std::begin(c), std::end(c)) {}
auto end(FixedBins< T, C > const &) noexcept
Definition: FixedBins.h:585
auto begin(FixedBins< T, C > const &) noexcept
Definition: FixedBins.h:573
input_adapter(std::FILE *file)
Definition: json.hpp:4202

Member Function Documentation

nlohmann::detail::input_adapter::operator input_adapter_t ( )
inline

Definition at line 4295 of file json.hpp.

4296  {
4297  return ia;
4298  }
input_adapter_t ia
the actual adapter
Definition: json.hpp:4302
template<class T , std::size_t N>
nlohmann::detail::input_adapter::std::end ( array  )
inline

Definition at line 4285 of file json.hpp.

array (ordered collection of values)
auto end(FixedBins< T, C > const &) noexcept
Definition: FixedBins.h:585
auto begin(FixedBins< T, C > const &) noexcept
Definition: FixedBins.h:573
input_adapter(std::FILE *file)
Definition: json.hpp:4202

Member Data Documentation

template<class T , std::size_t N>
nlohmann::detail::input_adapter::__pad0__

input adapter for array

Definition at line 4285 of file json.hpp.

input_adapter_t nlohmann::detail::input_adapter::ia = nullptr
private

the actual adapter

Definition at line 4302 of file json.hpp.


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