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
373  {
374  if (codepoint <= 0xFFFF) {
375  RAPIDJSON_ASSERT(codepoint < 0xD800 || codepoint > 0xDFFF); // Code point itself cannot be surrogate pair
376  *buffer++ = static_cast<Ch>(codepoint);
377  }
378  else {
379  RAPIDJSON_ASSERT(codepoint <= 0x10FFFF);
380  unsigned v = codepoint - 0x10000;
381  *buffer++ = static_cast<Ch>((v >> 10) + 0xD800);
382  *buffer++ = (v & 0x3FF) + 0xDC00;
383  }
384  return buffer;
385  }
Array< int, Dynamic, 1 > v
Definition: Array_initializer_list_vector_cxx11.cpp:1
#define RAPIDJSON_ASSERT(x)
Assertion.
Definition: rapidjson.h:80
CharType Ch
Definition: rapidjson.h:371

References RAPIDJSON_ASSERT, and v.


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