rapidjson::UTF16< CharType > Struct Template Reference

UTF-16 encoding. More...

#include <rapidjson.h>

+ Inheritance diagram for rapidjson::UTF16< CharType >:

Public Types

typedef CharType Ch
 

Static Public Member Functions

static ChEncode (Ch *buffer, unsigned codepoint)
 

Detailed Description

template<typename CharType = wchar_t>
struct rapidjson::UTF16< CharType >

UTF-16 encoding.

http://en.wikipedia.org/wiki/UTF-16

Template Parameters
CharTypeType for storing 16-bit UTF-16 data. Default is wchar_t. C++11 may use char16_t instead.

Member Typedef Documentation

◆ Ch

template<typename CharType = wchar_t>
typedef CharType rapidjson::UTF16< CharType >::Ch

Member Function Documentation

◆ Encode()

template<typename CharType = wchar_t>
static Ch* rapidjson::UTF16< CharType >::Encode ( Ch buffer,
unsigned  codepoint 
)
inlinestatic
398  {
399  if (codepoint <= 0xFFFF) {
400  RAPIDJSON_ASSERT(codepoint < 0xD800 || codepoint > 0xDFFF); // Code point itself cannot be surrogate pair
401  *buffer++ = static_cast<Ch>(codepoint);
402  }
403  else {
404  RAPIDJSON_ASSERT(codepoint <= 0x10FFFF);
405  unsigned v = codepoint - 0x10000;
406  *buffer++ = static_cast<Ch>((v >> 10) + 0xD800);
407  *buffer++ = (v & 0x3FF) + 0xDC00;
408  }
409  return buffer;
410  }
#define RAPIDJSON_ASSERT(x)
Assertion.
Definition: rapidjson.h:105
CharType Ch
Definition: rapidjson.h:396

References RAPIDJSON_ASSERT.


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