Ignore:
Timestamp:
2000-07-13T10:21:53+12:00 (24 years ago)
Author:
sjboddie
Message:

merged changes to trunk into New_Config_Format branch

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/New_Config_Format-branch/gsdl/lib/gsdlunicode.h

    r1076 r1279  
    215215};
    216216
     217
     218// Simple input and output converter classes for use with 8 bit encodings
     219// using simple textual map files. Map files should contain (at least) two
     220// tab-separated fields. The first field is the mapped value and the second
     221// field is the unicode value.
     222
     223struct ltus_t
     224{
     225  bool operator()(const unsigned short &t1, const unsigned short &t2) const
     226  { return t1 < t2; }
     227};
     228
     229
     230class simplemapconvert {
     231public:
     232  simplemapconvert () {absentc=0; loaded=false;}
     233  unsigned short convert (unsigned short c, bool in);
     234  void setmapfile (const text_t &themapfile) {mapfile = themapfile;}
     235
     236protected:
     237  bool loadmapfile (bool in);
     238
     239  map <unsigned short, unsigned short, ltus_t> mapping;
     240  bool loaded;
     241  text_t mapfile;
     242  unsigned short absentc;
     243};
     244
     245
     246class simplemapinconvertclass : public inconvertclass {
     247public:
     248  virtual ~simplemapinconvertclass () {}
     249
     250  void convert (text_t &output, status_t &status);
     251
     252  void setmapfile (const text_t &themapfile) {converter.setmapfile(themapfile);}
     253 
     254protected:
     255  simplemapconvert converter;
     256};
     257
     258class simplemapoutconvertclass : public rzwsoutconvertclass {
     259public:
     260  virtual ~simplemapoutconvertclass () {}
     261
     262  void convert (char *output, size_t maxlen,
     263        size_t &len, status_t &status);
     264
     265  void setmapfile (const text_t &themapfile) {converter.setmapfile(themapfile);}
     266 
     267protected:
     268  simplemapconvert converter;
     269};
     270
     271
     272
     273
    217274#endif
Note: See TracChangeset for help on using the changeset viewer.