Static Public Member Functions | List of all members
UTF16LE< CharType > Struct Template Reference

UTF-16 little endian encoding. More...

#include <encodings.h>

Inheritance diagram for UTF16LE< CharType >:
UTF16< CharType >

Static Public Member Functions

template<typename InputByteStream >
static CharType TakeBOM (InputByteStream &is)
 
template<typename InputByteStream >
static CharType Take (InputByteStream &is)
 
template<typename OutputByteStream >
static void PutBOM (OutputByteStream &os)
 
template<typename OutputByteStream >
static void Put (OutputByteStream &os, CharType c)
 
- Static Public Member Functions inherited from UTF16< CharType >
template<typename OutputStream >
static void Encode (OutputStream &os, unsigned codepoint)
 
template<typename OutputStream >
static void EncodeUnsafe (OutputStream &os, unsigned codepoint)
 
template<typename InputStream >
static bool Decode (InputStream &is, unsigned *codepoint)
 
template<typename InputStream , typename OutputStream >
static bool Validate (InputStream &is, OutputStream &os)
 

Additional Inherited Members

- Public Types inherited from UTF16< CharType >
enum  { supportUnicode = 1 }
 
typedef CharType Ch
 
- Public Member Functions inherited from UTF16< CharType >
 RAPIDJSON_STATIC_ASSERT (sizeof(Ch) >=2)
 

Detailed Description

template<typename CharType = wchar_t>
struct UTF16LE< CharType >

UTF-16 little endian encoding.

Definition at line 342 of file encodings.h.

Member Function Documentation

template<typename CharType = wchar_t>
template<typename OutputByteStream >
static void UTF16LE< CharType >::Put ( OutputByteStream &  os,
CharType  c 
)
inlinestatic

Definition at line 366 of file encodings.h.

366  {
367  RAPIDJSON_STATIC_ASSERT(sizeof(typename OutputByteStream::Ch) == 1);
368  os.Put(static_cast<typename OutputByteStream::Ch>(static_cast<unsigned>(c) & 0xFFu));
369  os.Put(static_cast<typename OutputByteStream::Ch>((static_cast<unsigned>(c) >> 8) & 0xFFu));
370  }
RAPIDJSON_STATIC_ASSERT(sizeof(Ch) >=2)
template<typename CharType = wchar_t>
template<typename OutputByteStream >
static void UTF16LE< CharType >::PutBOM ( OutputByteStream &  os)
inlinestatic

Definition at line 359 of file encodings.h.

359  {
360  RAPIDJSON_STATIC_ASSERT(sizeof(typename OutputByteStream::Ch) == 1);
361  os.Put(static_cast<typename OutputByteStream::Ch>(0xFFu));
362  os.Put(static_cast<typename OutputByteStream::Ch>(0xFEu));
363  }
RAPIDJSON_STATIC_ASSERT(sizeof(Ch) >=2)
template<typename CharType = wchar_t>
template<typename InputByteStream >
static CharType UTF16LE< CharType >::Take ( InputByteStream &  is)
inlinestatic

Definition at line 351 of file encodings.h.

351  {
352  RAPIDJSON_STATIC_ASSERT(sizeof(typename InputByteStream::Ch) == 1);
353  unsigned c = static_cast<uint8_t>(is.Take());
354  c |= static_cast<unsigned>(static_cast<uint8_t>(is.Take())) << 8;
355  return static_cast<CharType>(c);
356  }
RAPIDJSON_STATIC_ASSERT(sizeof(Ch) >=2)
unsigned char uint8_t
Definition: stdint.h:124
template<typename CharType = wchar_t>
template<typename InputByteStream >
static CharType UTF16LE< CharType >::TakeBOM ( InputByteStream &  is)
inlinestatic

Definition at line 344 of file encodings.h.

344  {
345  RAPIDJSON_STATIC_ASSERT(sizeof(typename InputByteStream::Ch) == 1);
346  CharType c = Take(is);
347  return static_cast<uint16_t>(c) == 0xFEFFu ? Take(is) : c;
348  }
RAPIDJSON_STATIC_ASSERT(sizeof(Ch) >=2)
unsigned short uint16_t
Definition: stdint.h:125
static CharType Take(InputByteStream &is)
Definition: encodings.h:351

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