Ignore:
Timestamp:
Jan 14, 2008, 6:44:50 AM (12 years ago)
Author:
cameron
Message:

CaseFoldBit?

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/charsets/ASCII_EBCDIC.h

    r17 r18  
     1#ifndef ASCII_EBCDIC_H
     2#define ASCII_EBCDIC_H
    13/* ASCII_EBCDIC.h
    24    Copyright (c) 2008, Robert D. Cameron.
     
    810
    911*/
    10 #ifndef ASCII_EBCDIC_H
    1112
    1213#include <stdint.h>
     
    1617template<CharBase C, unsigned char c> struct Ord;
    1718
    18 template<unsigned char c> struct Ord<Native, c> {static uint8_t const value = (uint8_t) c;};
    19 
    20 template<> struct Ord<ASCII,0> {static uint8_t const value = 0;};
     19template<unsigned char c>
     20struct Ord<Native, c> {static uint8_t const value = (uint8_t) c;};
     21
     22template<> struct Ord<ASCII,'\0'> {static uint8_t const value = 0x0;};
    2123template<> struct Ord<ASCII,' '> {static uint8_t const value = 0x20;};
    2224template<> struct Ord<ASCII,'!'> {static uint8_t const value = 0x21;};
     
    114116template<> struct Ord<ASCII,'}'> {static uint8_t const value = 0x7d;};
    115117
    116 template<> struct Ord<EBCDIC,0> {static uint8_t const value = 0;};
     118template<> struct Ord<EBCDIC,'\0'> {static uint8_t const value = 0x0;};
    117119template<> struct Ord<EBCDIC,' '> {static uint8_t const value = 0x40;};
    118120template<> struct Ord<EBCDIC,'!'> {static uint8_t const value = 0x5a;};
     
    209211template<> struct Ord<EBCDIC,'|'> {static uint8_t const value = 0x4f;};
    210212template<> struct Ord<EBCDIC,'}'> {static uint8_t const value = 0xd0;};
     213
     214// CaseFoldBit is the bit that differs between upper and lower
     215// case versions of the same letter.  Both ASCII and EBCDIC have
     216// the property that a single case fold bit exists and is the same
     217// for all letters. 
     218template <CharBase CS>
     219struct CaseFoldBit
     220  {static uint8_t const value = Ord<CS, 'a'>::value ^ Ord<CS, 'A'>::value;};
     221
    211222#endif
Note: See TracChangeset for help on using the changeset viewer.