IN2OSM  1.0.1
ASCII< CharType >

ASCII encoding. More...

#include <encodings.h>

Collaboration diagram for ASCII< CharType >:
Collaboration graph

Public Types

enum  { supportUnicode = 0 }
 
typedef CharType Ch
 

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)
 
template<typename InputByteStream >
static CharType TakeBOM (InputByteStream &is)
 
template<typename InputByteStream >
static Ch Take (InputByteStream &is)
 
template<typename OutputByteStream >
static void PutBOM (OutputByteStream &os)
 
template<typename OutputByteStream >
static void Put (OutputByteStream &os, Ch c)
 

Detailed Description

template<typename CharType = char>
struct ASCII< CharType >

ASCII encoding.

http://en.wikipedia.org/wiki/ASCII

Template Parameters
CharTypeCode unit for storing 7-bit ASCII data. Default is char.
Note
implements Encoding concept

Definition at line 542 of file encodings.h.

Member Typedef Documentation

◆ Ch

typedef CharType Ch

Definition at line 543 of file encodings.h.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
Enumerator
supportUnicode 

Definition at line 545 of file encodings.h.

Member Function Documentation

◆ Decode()

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

Definition at line 560 of file encodings.h.

560  {
561  uint8_t c = static_cast<uint8_t>(is.Take());
562  *codepoint = c;
563  return c <= 0X7F;
564  }
unsigned char uint8_t
Definition: stdint.h:124

◆ Encode()

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

Definition at line 548 of file encodings.h.

548  {
549  RAPIDJSON_ASSERT(codepoint <= 0x7F);
550  os.Put(static_cast<Ch>(codepoint & 0xFF));
551  }
#define RAPIDJSON_ASSERT(x)
Assertion.
Definition: rapidjson.h:406

◆ EncodeUnsafe()

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

Definition at line 554 of file encodings.h.

554  {
555  RAPIDJSON_ASSERT(codepoint <= 0x7F);
556  PutUnsafe(os, static_cast<Ch>(codepoint & 0xFF));
557  }
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,
Ch  c 
)
inlinestatic

Definition at line 593 of file encodings.h.

593  {
594  RAPIDJSON_STATIC_ASSERT(sizeof(typename OutputByteStream::Ch) == 1);
595  os.Put(static_cast<typename OutputByteStream::Ch>(c));
596  }
#define RAPIDJSON_STATIC_ASSERT(x)
(Internal) macro to check for conditions at compile-time
Definition: rapidjson.h:445

◆ PutBOM()

static void PutBOM ( OutputByteStream &  os)
inlinestatic

Definition at line 587 of file encodings.h.

587  {
588  RAPIDJSON_STATIC_ASSERT(sizeof(typename OutputByteStream::Ch) == 1);
589  (void)os;
590  }
#define RAPIDJSON_STATIC_ASSERT(x)
(Internal) macro to check for conditions at compile-time
Definition: rapidjson.h:445

◆ Take()

static Ch Take ( InputByteStream &  is)
inlinestatic

Definition at line 581 of file encodings.h.

581  {
582  RAPIDJSON_STATIC_ASSERT(sizeof(typename InputByteStream::Ch) == 1);
583  return static_cast<Ch>(is.Take());
584  }
#define RAPIDJSON_STATIC_ASSERT(x)
(Internal) macro to check for conditions at compile-time
Definition: rapidjson.h:445
CharType Ch
Definition: encodings.h:543

◆ TakeBOM()

static CharType TakeBOM ( InputByteStream &  is)
inlinestatic

Definition at line 574 of file encodings.h.

574  {
575  RAPIDJSON_STATIC_ASSERT(sizeof(typename InputByteStream::Ch) == 1);
576  uint8_t c = static_cast<uint8_t>(Take(is));
577  return static_cast<Ch>(c);
578  }
#define RAPIDJSON_STATIC_ASSERT(x)
(Internal) macro to check for conditions at compile-time
Definition: rapidjson.h:445
unsigned char uint8_t
Definition: stdint.h:124
CharType Ch
Definition: encodings.h:543
static Ch Take(InputByteStream &is)
Definition: encodings.h:581
Here is the call graph for this function:

◆ Validate()

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

Definition at line 567 of file encodings.h.

567  {
568  uint8_t c = static_cast<uint8_t>(is.Take());
569  os.Put(static_cast<typename OutputStream::Ch>(c));
570  return c <= 0x7F;
571  }
unsigned char uint8_t
Definition: stdint.h:124

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