Changeset 103 for trunk/src/byteplex.h


Ignore:
Timestamp:
Apr 16, 2008, 12:32:45 PM (11 years ago)
Author:
cameron
Message:

X8_Buffer<C> to unify 8-bit byteplex classes for ASCII and EBCDIC families.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/byteplex.h

    r100 r103  
    9191        FILE * infile;
    9292        int packs_in_buffer;
     93        int CopyAndFill(unsigned char * bytes_to_copy, int lgth, int bytes_to_read);
    9394        void Set_limits(int units_in_buffer);
    9495
    9596};
    9697
     98
     99/*  The X8_Buffer template class is used for either ASCII- or EBCDIC-
     100    based 8-bit code units.
     101    The X8_Buffer<ASCII> class includes 7-bit ASCII
     102    (with high-order bit 0), the ISO-8859 character sets and UTF-8.
     103
     104    The family of 8-bit EBCDIC based character sets are processed using
     105    the X8_Buffer<EBCDIC> class.
     106*/
     107
    97108template <CodeUnit_Base C>
    98 class XML_Buffer : public Byteplex {
     109class X8_Buffer : public Byteplex {
    99110public:
    100         XML_Buffer ();
    101         ~XML_Buffer();
     111        X8_Buffer();
     112        ~X8_Buffer();
    102113       
    103         virtual void DoByteplex() = 0;
    104         virtual void PreparePseudoASCII_Stream() = 0;
    105         virtual void AdvanceInputBuffer(int advance_amt) = 0;
    106         virtual void InitializeBuffer(unsigned char * src, int lgth) = 0;
    107 protected:
    108         int CopyAndFill(unsigned char * bytes_to_copy, int lgth, int bytes_to_read);
    109 };
    110 
    111 
    112 /*  Various ASCII based character sets using 8-bit code units are processed
    113     using the Extended_ASCII_8_Buffer class.   This includes 7-bit ASCII
    114     itself (with high-order bit 0), the ISO-8859 character sets and UTF-8.
    115 */
    116 class Extended_ASCII_8_Buffer : public XML_Buffer<ASCII> {
    117 public:
    118         Extended_ASCII_8_Buffer();
    119         void DoByteplex();
    120         void PreparePseudoASCII_Stream();
    121         void AdvanceInputBuffer(int advance_amt);
    122         void InitializeBuffer(unsigned char * src, int lgth);
    123 };
    124 
    125 /*  The family of 8-bit EBCDIC based character sets are processed using
    126     the EBCDIC_Buffer class.
    127 */
    128 class EBCDIC_Buffer : public XML_Buffer<EBCDIC> {
    129 public:
    130         EBCDIC_Buffer();
    131114        void DoByteplex();
    132115        void PreparePseudoASCII_Stream();
     
    136119
    137120
    138 
    139 /*  UTF-16 and UCS-4 character set families in BE and LE byte orders.
     121/*  UTF-16 and UCS-2 character set families in BE and LE byte orders.
    140122    The U16LE and U16BE subclasses each provide a distinct byteplexer to
    141123    produce 2 parallel byte streams for the high and low bytes of each
     
    143125    conversion routine can be applied at the U16_Buffer level. */
    144126
    145 class U16_Buffer : public XML_Buffer<ASCII> {
     127class U16_Buffer : public Byteplex {
    146128public:
    147129        U16_Buffer();
     
    174156    byteplexing is complete, a generic pseudoASCII routine can
    175157    be applied. */
    176 class U32_Buffer : public XML_Buffer<ASCII> {
     158class U32_Buffer : public Byteplex {
    177159public:
    178160        U32_Buffer();
Note: See TracChangeset for help on using the changeset viewer.