Changeset 23 for trunk/src


Ignore:
Timestamp:
Jan 21, 2008, 8:31:56 AM (11 years ago)
Author:
cameron
Message:

Version-dependent WhiteSpace?; update for CodeUnit_Base

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bytelex.h

    r22 r23  
    99#define BYTELEX_H
    1010
    11 
     11#include "xmlparam.h"
    1212#include "multiliteral.h"
    1313
    14 template<CharBase C, unsigned char c>
     14template<CodeUnit_Base C, unsigned char c>
    1515inline bool AtChar(unsigned char x8data[]) {
    1616  return x8data[0] == Ord<C, c>::value;
    1717}
    1818
     19// Whitespace recognition.  This varies between XML 1.0 and
     20// XML 1.1, but only the XML 1.0 version is needed.
    1921// Specific ASCII/EBCDIC versions are hard-coded here, because
    2022// the Ord metafunction currently only works for printable characters.
    21 // Could be improved.
    22 template<CharBase C>
     23// Could be improved. 
     24template<XML_version, CodeUnit_Base C>
    2325inline bool at_WhiteSpace(unsigned char x8data[]);
    2426
    2527template<>
    26 inline bool at_WhiteSpace<ASCII>(unsigned char x8data[]) {
     28inline bool at_WhiteSpace<XML_1_0, ASCII>(unsigned char x8data[]) {
    2729  unsigned char ch = x8data[0];
    2830  return (ch == Ord<ASCII, ' '>::value) ||
     
    3133
    3234template<>
    33 inline bool at_WhiteSpace<EBCDIC>(unsigned char x8data[]) {
     35inline bool at_WhiteSpace<XML_1_0, EBCDIC>(unsigned char x8data[]) {
    3436  unsigned char ch = x8data[0];
    3537  return (ch == Ord<EBCDIC, ' '>::value) ||
     
    3941
    4042
    41 template<CharBase C>
     43template<CodeUnit_Base C>
    4244inline bool at_EndTag_Start(unsigned char x8data[]) {
    4345  return s2int16(x8data) == c2int16<C, '<', '/'>::value;
    4446}
    4547
    46 template<CharBase C>
     48template<CodeUnit_Base C>
    4749inline bool at_Comment_Start(unsigned char x8data[]) {
    4850  return s4int32(x8data) == c4int32<C, '<', '!', '-', '-'>::value;
    4951}
    5052
    51 template<CharBase C>
     53template<CodeUnit_Base C>
    5254inline bool at_DoubleHyphen(unsigned char x8data[]) {
    5355  return s2int16(x8data) == c2int16<C, '-', '-'>::value;
    5456}
    5557
    56 template<CharBase C>
     58template<CodeUnit_Base C>
    5759inline bool at_Comment_End(unsigned char x8data[]) {
    5860  return s3int32(x8data) == c3int32<C, '-', '-', '>'>::value;
    5961}
    6062
    61 template<CharBase C>
     63template<CodeUnit_Base C>
    6264inline bool at_CDATA_Start(unsigned char x8data[]) {
    6365  return s8int64(x8data) ==
     
    6567}
    6668
    67 template<CharBase C>
     69template<CodeUnit_Base C>
    6870inline bool at_CDATA_End(unsigned char x8data[]) {
    6971  return s3int32(x8data) == c3int32<C, ']', ']', '>'>::value;
    7072}
    7173
    72 template<CharBase C>
     74template<CodeUnit_Base C>
    7375inline bool at_PI_Start(unsigned char x8data[]) {
    7476  return s2int16(x8data) == c2int16<C, '<', '?'>::value;
    7577}
    7678
    77 template<CharBase C>
     79template<CodeUnit_Base C>
    7880inline bool at_PI_End(unsigned char x8data[]) {
    7981  return s2int16(x8data) == c2int16<C, '?', '>'>::value;
    8082}
    8183
    82 template<CharBase C>
     84template<CodeUnit_Base C>
    8385inline bool at_EqualsDQuote(unsigned char x8data[]) {
    8486  return s2int16(x8data) == c2int16<C, '=', '"'>::value;
    8587}
    8688
    87 template<CharBase C>
     89template<CodeUnit_Base C>
    8890inline bool at_EqualsSQuote(unsigned char x8data[]) {
    8991  return s2int16(x8data) == c2int16<C, '=', '\''>::value;
    9092}
    9193
    92 template<CharBase C>
     94template<CodeUnit_Base C>
    9395inline bool at_xmlns(unsigned char x8data[]) {
    9496  return s5int64(x8data) == c5int64<C, 'x', 'm', 'l', 'n', 's'>::value;
    9597}
    9698
    97 template<CharBase C>
     99template<CodeUnit_Base C>
    98100inline bool at_EmptyElementDelim(unsigned char x8data[]) {
    99101  return s2int16(x8data) == c2int16<C, '/', '>'>::value;
    100102}
    101103
    102 template<CharBase C>
     104template<CodeUnit_Base C>
    103105inline bool at_XmlDecl_start(unsigned char x8data[]) {
    104106  return (s5int64(x8data) == c5int64<C, '<', '?', 'x', 'm', 'l'>::value) &&
     
    106108}
    107109
    108 template<CharBase C>
     110template<CodeUnit_Base C>
    109111inline bool at_version(unsigned char x8data[]) {
    110112  return s7int64(x8data) == c7int64<C, 'v', 'e', 'r', 's', 'i', 'o', 'n'>::value;
    111113}
    112114
    113 template<CharBase C>
     115template<CodeUnit_Base C>
    114116inline bool at_1_0(unsigned char x8data[]) {
    115117  return (s5int64(x8data) == c5int64<C, '"', '1', '.', '0', '"'>::value) ||
     
    117119}
    118120
    119 template<CharBase C>
     121template<CodeUnit_Base C>
    120122inline bool at_1_1(unsigned char x8data[]) {
    121123  return (s5int64(x8data) == c5int64<C, '"', '1', '.', '1', '"'>::value) ||
     
    123125}
    124126
    125 template<CharBase C>
     127template<CodeUnit_Base C>
    126128inline bool at_encoding(unsigned char x8data[]) {
    127129  return s8int64(x8data) == c8int64<C, 'e', 'n', 'c', 'o', 'd', 'i', 'n', 'g'>::value;
    128130}
    129131
    130 template<CharBase C>
     132template<CodeUnit_Base C>
    131133inline bool at_standalone(unsigned char x8data[]) {
    132134  return (s8int64(x8data) == c8int64<C, 's', 't', 'a', 'n', 'd', 'a', 'l', 'o'>::value) &
     
    134136}
    135137
    136 template<CharBase C>
     138template<CodeUnit_Base C>
    137139inline bool at_yes(unsigned char x8data[]) {
    138140  return (s5int64(x8data) == c5int64<C, '"', 'y', 'e', 's', '"'>::value) |
     
    140142}
    141143
    142 template<CharBase C>
     144template<CodeUnit_Base C>
    143145inline bool at_no(unsigned char x8data[]) {
    144146  return (s4int32(x8data) == c4int32<C, '"', 'n', 'o', '"'>::value) |
     
    146148}
    147149
    148 template<CharBase C>
     150template<CodeUnit_Base C>
    149151inline bool at_XxMmLll_WS(unsigned char x8data[]) {
    150152  uint32_t case_mask = ~(CaseFoldBit<C>::value * 0x01010101);
     
    160162   The following is ugly and works only for ASCII.
    161163*/
    162 template<CharBase C>
     164template<CodeUnit_Base C>
    163165inline bool at_ElementTag_Start(unsigned char x8data[]);
    164166
Note: See TracChangeset for help on using the changeset viewer.