TrinityCore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
ASCII< CharType > Struct Template Reference

ASCII encoding. More...

#include <encodings.h>

Public Types

enum  { supportUnicode = 0 }
 
typedef CharType Ch
 

Static Public Member Functions

template<typename OutputStream >
static void Encode (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

Member Typedef Documentation

template<typename CharType = char>
typedef CharType ASCII< CharType >::Ch

Member Enumeration Documentation

template<typename CharType = char>
anonymous enum
Enumerator
supportUnicode 
486 { supportUnicode = 0 };
Definition: encodings.h:486

Member Function Documentation

template<typename CharType = char>
template<typename InputStream >
static bool ASCII< CharType >::Decode ( InputStream &  is,
unsigned *  codepoint 
)
inlinestatic
495  {
496  unsigned char c = static_cast<unsigned char>(is.Take());
497  *codepoint = c;
498  return c <= 0X7F;
499  }
template<typename CharType = char>
template<typename OutputStream >
static void ASCII< CharType >::Encode ( OutputStream &  os,
unsigned  codepoint 
)
inlinestatic
489  {
490  RAPIDJSON_ASSERT(codepoint <= 0x7F);
491  os.Put(static_cast<Ch>(codepoint & 0xFF));
492  }
#define RAPIDJSON_ASSERT(x)
Assertion.
Definition: rapidjson.h:344
template<typename CharType = char>
template<typename OutputByteStream >
static void ASCII< CharType >::Put ( OutputByteStream &  os,
Ch  c 
)
inlinestatic
528  {
529  RAPIDJSON_STATIC_ASSERT(sizeof(typename OutputByteStream::Ch) == 1);
530  os.Put(static_cast<typename OutputByteStream::Ch>(c));
531  }
#define RAPIDJSON_STATIC_ASSERT(x)
(Internal) macro to check for conditions at compile-time
Definition: rapidjson.h:375
template<typename CharType = char>
template<typename OutputByteStream >
static void ASCII< CharType >::PutBOM ( OutputByteStream &  os)
inlinestatic
522  {
523  RAPIDJSON_STATIC_ASSERT(sizeof(typename OutputByteStream::Ch) == 1);
524  (void)os;
525  }
#define RAPIDJSON_STATIC_ASSERT(x)
(Internal) macro to check for conditions at compile-time
Definition: rapidjson.h:375
template<typename CharType = char>
template<typename InputByteStream >
static Ch ASCII< CharType >::Take ( InputByteStream &  is)
inlinestatic
516  {
517  RAPIDJSON_STATIC_ASSERT(sizeof(typename InputByteStream::Ch) == 1);
518  return is.Take();
519  }
#define RAPIDJSON_STATIC_ASSERT(x)
(Internal) macro to check for conditions at compile-time
Definition: rapidjson.h:375

+ Here is the caller graph for this function:

template<typename CharType = char>
template<typename InputByteStream >
static CharType ASCII< CharType >::TakeBOM ( InputByteStream &  is)
inlinestatic
509  {
510  RAPIDJSON_STATIC_ASSERT(sizeof(typename InputByteStream::Ch) == 1);
511  Ch c = Take(is);
512  return c;
513  }
#define RAPIDJSON_STATIC_ASSERT(x)
(Internal) macro to check for conditions at compile-time
Definition: rapidjson.h:375
static Ch Take(InputByteStream &is)
Definition: encodings.h:516
CharType Ch
Definition: encodings.h:484

+ Here is the call graph for this function:

template<typename CharType = char>
template<typename InputStream , typename OutputStream >
static bool ASCII< CharType >::Validate ( InputStream &  is,
OutputStream &  os 
)
inlinestatic
502  {
503  unsigned char c = is.Take();
504  os.Put(c);
505  return c <= 0x7F;
506  }

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