IN2OSM  1.0.1
UTF32BE< CharType >

UTF-32 big endian encoding. More...

#include <encodings.h>

Inheritance diagram for UTF32BE< CharType >:
Inheritance graph
Collaboration diagram for UTF32BE< 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 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)
 
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 UTF32BE< CharType >

UTF-32 big endian encoding.

Definition at line 496 of file encodings.h.

Member Typedef Documentation

◆ Ch

typedef CharType Ch
inherited

Definition at line 419 of file encodings.h.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
inherited
Enumerator
supportUnicode 

Definition at line 422 of file encodings.h.

Member Function Documentation

◆ Decode()

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

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 
)
inlinestaticinherited

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 
)
inlinestaticinherited

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:

◆ Put()

static void Put ( OutputByteStream &  os,
CharType  c 
)
inlinestatic

Definition at line 524 of file encodings.h.

524  {
525  RAPIDJSON_STATIC_ASSERT(sizeof(typename OutputByteStream::Ch) == 1);
526  os.Put(static_cast<typename OutputByteStream::Ch>((c >> 24) & 0xFFu));
527  os.Put(static_cast<typename OutputByteStream::Ch>((c >> 16) & 0xFFu));
528  os.Put(static_cast<typename OutputByteStream::Ch>((c >> 8) & 0xFFu));
529  os.Put(static_cast<typename OutputByteStream::Ch>(c & 0xFFu));
530  }
RAPIDJSON_STATIC_ASSERT(sizeof(Ch) >=4)

◆ PutBOM()

static void PutBOM ( OutputByteStream &  os)
inlinestatic

Definition at line 515 of file encodings.h.

515  {
516  RAPIDJSON_STATIC_ASSERT(sizeof(typename OutputByteStream::Ch) == 1);
517  os.Put(static_cast<typename OutputByteStream::Ch>(0x00u));
518  os.Put(static_cast<typename OutputByteStream::Ch>(0x00u));
519  os.Put(static_cast<typename OutputByteStream::Ch>(0xFEu));
520  os.Put(static_cast<typename OutputByteStream::Ch>(0xFFu));
521  }
RAPIDJSON_STATIC_ASSERT(sizeof(Ch) >=4)

◆ RAPIDJSON_STATIC_ASSERT()

RAPIDJSON_STATIC_ASSERT ( sizeof(Ch) >=  4)
inherited

◆ Take()

static CharType Take ( InputByteStream &  is)
inlinestatic

Definition at line 505 of file encodings.h.

505  {
506  RAPIDJSON_STATIC_ASSERT(sizeof(typename InputByteStream::Ch) == 1);
507  unsigned c = static_cast<unsigned>(static_cast<uint8_t>(is.Take())) << 24;
508  c |= static_cast<unsigned>(static_cast<uint8_t>(is.Take())) << 16;
509  c |= static_cast<unsigned>(static_cast<uint8_t>(is.Take())) << 8;
510  c |= static_cast<unsigned>(static_cast<uint8_t>(is.Take()));
511  return static_cast<CharType>(c);
512  }
unsigned char uint8_t
Definition: stdint.h:124
RAPIDJSON_STATIC_ASSERT(sizeof(Ch) >=4)

◆ TakeBOM()

static CharType TakeBOM ( InputByteStream &  is)
inlinestatic

Definition at line 498 of file encodings.h.

498  {
499  RAPIDJSON_STATIC_ASSERT(sizeof(typename InputByteStream::Ch) == 1);
500  CharType c = Take(is);
501  return static_cast<uint32_t>(c) == 0x0000FEFFu ? Take(is) : c;
502  }
static CharType Take(InputByteStream &is)
Definition: encodings.h:505
unsigned int uint32_t
Definition: stdint.h:126
RAPIDJSON_STATIC_ASSERT(sizeof(Ch) >=4)
Here is the call graph for this function:

◆ Validate()

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

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: