IN2OSM  1.0.1
UTF32< CharType >

UTF-32 encoding. More...

#include <encodings.h>

Inheritance diagram for UTF32< CharType >:
Inheritance graph
Collaboration diagram for UTF32< CharType >:
Collaboration graph

Public Types

enum  { supportUnicode = 1 }
 
typedef CharType Ch
 

Public Member Functions

 RAPIDJSON_STATIC_ASSERT (sizeof(Ch) >=4)
 

Static Public Member Functions

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)
 

Detailed Description

template<typename CharType = unsigned>
struct UTF32< CharType >

UTF-32 encoding.

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

Template Parameters
CharTypeType for storing 32-bit UTF-32 data. Default is unsigned. C++11 may use char32_t instead.
Note
implements Encoding concept
For in-memory access, no need to concern endianness. The code units and code points are represented by CPU's endianness. For streaming, use UTF32LE and UTF32BE, which handle endianness.

Definition at line 418 of file encodings.h.

Member Typedef Documentation

◆ Ch

typedef CharType Ch

Definition at line 419 of file encodings.h.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
Enumerator
supportUnicode 

Definition at line 422 of file encodings.h.

Member Function Documentation

◆ Decode()

static bool Decode ( InputStream &  is,
unsigned *  codepoint 
)
inlinestatic

Definition at line 439 of file encodings.h.

439  {
440  RAPIDJSON_STATIC_ASSERT(sizeof(typename InputStream::Ch) >= 4);
441  Ch c = is.Take();
442  *codepoint = c;
443  return c <= 0x10FFFF;
444  }
CharType Ch
Definition: encodings.h:419
RAPIDJSON_STATIC_ASSERT(sizeof(Ch) >=4)

◆ Encode()

static void Encode ( OutputStream &  os,
unsigned  codepoint 
)
inlinestatic

Definition at line 425 of file encodings.h.

425  {
426  RAPIDJSON_STATIC_ASSERT(sizeof(typename OutputStream::Ch) >= 4);
427  RAPIDJSON_ASSERT(codepoint <= 0x10FFFF);
428  os.Put(codepoint);
429  }
RAPIDJSON_STATIC_ASSERT(sizeof(Ch) >=4)
#define RAPIDJSON_ASSERT(x)
Assertion.
Definition: rapidjson.h:406

◆ EncodeUnsafe()

static void EncodeUnsafe ( OutputStream &  os,
unsigned  codepoint 
)
inlinestatic

Definition at line 432 of file encodings.h.

432  {
433  RAPIDJSON_STATIC_ASSERT(sizeof(typename OutputStream::Ch) >= 4);
434  RAPIDJSON_ASSERT(codepoint <= 0x10FFFF);
435  PutUnsafe(os, codepoint);
436  }
RAPIDJSON_STATIC_ASSERT(sizeof(Ch) >=4)
void PutUnsafe(Stream &stream, typename Stream::Ch c)
Write character to a stream, presuming buffer is reserved.
Definition: stream.h:91
#define RAPIDJSON_ASSERT(x)
Assertion.
Definition: rapidjson.h:406
Here is the call graph for this function:

◆ RAPIDJSON_STATIC_ASSERT()

RAPIDJSON_STATIC_ASSERT ( sizeof(Ch) >=  4)

◆ Validate()

static bool Validate ( InputStream &  is,
OutputStream &  os 
)
inlinestatic

Definition at line 447 of file encodings.h.

447  {
448  RAPIDJSON_STATIC_ASSERT(sizeof(typename InputStream::Ch) >= 4);
449  Ch c;
450  os.Put(c = is.Take());
451  return c <= 0x10FFFF;
452  }
CharType Ch
Definition: encodings.h:419
RAPIDJSON_STATIC_ASSERT(sizeof(Ch) >=4)

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