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

#include <json.hpp>

Inheritance diagram for nlohmann::detail::wide_string_input_adapter< WideStringType >:
nlohmann::detail::input_adapter_protocol

Public Member Functions

 wide_string_input_adapter (const WideStringType &w) noexcept
 
std::char_traits< char >::int_type get_character () noexceptoverride
 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 Member Functions

template<size_t T>
void fill_buffer ()
 

Private Attributes

const WideStringType & str
 the wstring to process More...
 
std::size_t current_wchar = 0
 index of the current wchar in str More...
 
std::array< std::char_traits
< char >::int_type, 4 > 
utf8_bytes = {{0, 0, 0, 0}}
 a buffer for UTF-8 bytes More...
 
std::size_t utf8_bytes_index = 0
 index to the utf8_codes array for the next valid byte More...
 
std::size_t utf8_bytes_filled = 0
 number of valid bytes in the utf8_codes array More...
 

Detailed Description

template<typename WideStringType>
class nlohmann::detail::wide_string_input_adapter< WideStringType >

Definition at line 4151 of file json.hpp.

Constructor & Destructor Documentation

template<typename WideStringType >
nlohmann::detail::wide_string_input_adapter< WideStringType >::wide_string_input_adapter ( const WideStringType &  w)
inlineexplicitnoexcept

Definition at line 4154 of file json.hpp.

4155  : str(w)
4156  {}
const WideStringType & str
the wstring to process
Definition: json.hpp:4183

Member Function Documentation

template<typename WideStringType >
template<size_t T>
void nlohmann::detail::wide_string_input_adapter< WideStringType >::fill_buffer ( )
inlineprivate

Definition at line 4177 of file json.hpp.

4178  {
4180  }
std::array< std::char_traits< char >::int_type, 4 > utf8_bytes
a buffer for UTF-8 bytes
Definition: json.hpp:4189
static void fill_buffer(const WideStringType &str, size_t &current_wchar, std::array< std::char_traits< char >::int_type, 4 > &utf8_bytes, size_t &utf8_bytes_index, size_t &utf8_bytes_filled)
Definition: json.hpp:4030
std::size_t utf8_bytes_filled
number of valid bytes in the utf8_codes array
Definition: json.hpp:4194
std::size_t current_wchar
index of the current wchar in str
Definition: json.hpp:4186
const WideStringType & str
the wstring to process
Definition: json.hpp:4183
std::size_t utf8_bytes_index
index to the utf8_codes array for the next valid byte
Definition: json.hpp:4192
template<typename WideStringType >
std::char_traits<char>::int_type nlohmann::detail::wide_string_input_adapter< WideStringType >::get_character ( )
inlineoverridevirtualnoexcept

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

Implements nlohmann::detail::input_adapter_protocol.

Definition at line 4158 of file json.hpp.

4159  {
4160  // check if buffer needs to be filled
4162  {
4163  fill_buffer<sizeof(typename WideStringType::value_type)>();
4164 
4165  assert(utf8_bytes_filled > 0);
4166  assert(utf8_bytes_index == 0);
4167  }
4168 
4169  // use buffer
4170  assert(utf8_bytes_filled > 0);
4172  return utf8_bytes[utf8_bytes_index++];
4173  }
std::array< std::char_traits< char >::int_type, 4 > utf8_bytes
a buffer for UTF-8 bytes
Definition: json.hpp:4189
std::size_t utf8_bytes_filled
number of valid bytes in the utf8_codes array
Definition: json.hpp:4194
std::size_t utf8_bytes_index
index to the utf8_codes array for the next valid byte
Definition: json.hpp:4192

Member Data Documentation

template<typename WideStringType >
std::size_t nlohmann::detail::wide_string_input_adapter< WideStringType >::current_wchar = 0
private

index of the current wchar in str

Definition at line 4186 of file json.hpp.

template<typename WideStringType >
const WideStringType& nlohmann::detail::wide_string_input_adapter< WideStringType >::str
private

the wstring to process

Definition at line 4183 of file json.hpp.

template<typename WideStringType >
std::array<std::char_traits<char>::int_type, 4> nlohmann::detail::wide_string_input_adapter< WideStringType >::utf8_bytes = {{0, 0, 0, 0}}
private

a buffer for UTF-8 bytes

Definition at line 4189 of file json.hpp.

template<typename WideStringType >
std::size_t nlohmann::detail::wide_string_input_adapter< WideStringType >::utf8_bytes_filled = 0
private

number of valid bytes in the utf8_codes array

Definition at line 4194 of file json.hpp.

template<typename WideStringType >
std::size_t nlohmann::detail::wide_string_input_adapter< WideStringType >::utf8_bytes_index = 0
private

index to the utf8_codes array for the next valid byte

Definition at line 4192 of file json.hpp.


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