Changeset 1870 for trunk/gsdl/lib


Ignore:
Timestamp:
2001-01-29T14:54:58+13:00 (23 years ago)
Author:
sjboddie
Message:

Tidied up language support stuff.

Location:
trunk/gsdl/lib
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/gsdl/lib/gsdlunicode.cpp

    r1310 r1870  
    263263// setmapfile will cause loadmapfile to be called when conversion is
    264264// needed
    265 bool mapconvert::setmapfile (const text_t &thegsdlhome, const text_t &theencoding,
    266                  unsigned short theabsentc) {
     265bool mapconvert::setmapfile (const text_t &themapfile, unsigned short theabsentc) {
    267266  // check to see if the mapfile has been already loaded
    268   if (mapdata.loaded && gsdlhome == thegsdlhome &&
    269       encoding == theencoding && absentc == theabsentc)
    270     return true;
     267  if (mapdata.loaded && mapfile == themapfile && absentc == theabsentc) return true;
    271268
    272269  unloadmapfile ();
    273   gsdlhome = thegsdlhome;
    274   encoding = theencoding;
     270  mapfile = themapfile;
    275271  absentc = theabsentc;
    276272 
     
    281277
    282278// loadmapfile should be called before any conversion is done
    283 bool mapconvert::loadmapfile (const text_t &thegsdlhome,
    284                   const text_t &theencoding,
     279bool mapconvert::loadmapfile (const text_t &themapfile,
    285280                  unsigned short theabsentc) {
    286281  FILE *mapfilein = (FILE *)NULL;
    287282
    288283  // check to see if the mapfile has been already loaded
    289   if (mapdata.loaded && gsdlhome == thegsdlhome &&
    290       encoding == theencoding && absentc == theabsentc)
    291     return true;
     284  if (mapdata.loaded && mapfile == themapfile && absentc == theabsentc) return true;
    292285
    293286  unloadmapfile ();
    294   gsdlhome = thegsdlhome;
    295   encoding = theencoding;
     287  mapfile = themapfile;
    296288  absentc = theabsentc;
    297289
    298290  // open the map file
    299   text_t filename = filename_cat (gsdlhome, "unicode");
    300   filename = filename_cat (filename, encoding);
    301   filename += ".ump";
    302   char *cfilename = filename.getcstr();
     291  char *cfilename = mapfile.getcstr();
    303292  if (cfilename == (char *)NULL) return false;
    304293  mapfilein = fopen(cfilename, "rb");
     
    359348unsigned short mapconvert::convert (unsigned short c) {
    360349  if (!mapdata.loaded) {
    361     if (!gsdlhome.empty() && !encoding.empty() &&
    362     loadmapfile (gsdlhome, encoding, absentc)) {
     350    if (!mapfile.empty() && loadmapfile (mapfile, absentc)) {
    363351      // do nothing, successfully loaded database
    364352    } else return absentc;
  • trunk/gsdl/lib/gsdlunicode.h

    r1310 r1870  
    114114  // setmapfile will cause loadmapfile to be called when conversion is
    115115  // needed
    116   bool setmapfile (const text_t &thegsdlhome, const text_t &theencoding,
    117            unsigned short theabsentc);
     116  bool setmapfile (const text_t &themapfile, unsigned short theabsentc);
    118117
    119118  // loadmapfile should be called before any conversion is done
    120   bool loadmapfile (const text_t &thegsdlhome, const text_t &theencoding,
    121             unsigned short theabsentc);
     119  bool loadmapfile (const text_t &themapfile, unsigned short theabsentc);
    122120  void unloadmapfile ();
    123121
     
    129127
    130128protected:
    131   text_t gsdlhome;
    132   text_t encoding;
     129  text_t mapfile;
    133130  unsigned short absentc;
    134131  mapdata_t mapdata;
     
    146143
    147144  // setmapfile will cause loadmapfile to be called when conversion is needed
    148   bool setmapfile (const text_t &thegsdlhome, const text_t &theencoding,
    149             unsigned short theabsentc) {
    150     return converter.setmapfile (thegsdlhome, theencoding, theabsentc);
     145  bool setmapfile (const text_t &themapfile, unsigned short theabsentc) {
     146    return converter.setmapfile (themapfile, theabsentc);
    151147  };
    152148
    153149  // loadmapfile should be called before any conversion takes
    154150  // place
    155   bool loadmapfile (const text_t &thegsdlhome, const text_t &theencoding,
    156             unsigned short theabsentc) {
    157     return converter.loadmapfile (thegsdlhome, theencoding, theabsentc);
     151  bool loadmapfile (const text_t &themapfile, unsigned short theabsentc) {
     152    return converter.loadmapfile (themapfile, theabsentc);
    158153  };
    159154
     
    189184
    190185  // setmapfile will cause loadmapfile to be called when conversion is needed
    191   bool setmapfile (const text_t &thegsdlhome, const text_t &theencoding,
    192             unsigned short theabsentc) {
    193     return converter.setmapfile (thegsdlhome, theencoding, theabsentc);
     186  bool setmapfile (const text_t &themapfile, unsigned short theabsentc) {
     187    return converter.setmapfile (themapfile, theabsentc);
    194188  };
    195189
    196190  // loadmapfile should be called before any conversion takes
    197191  // place
    198   bool loadmapfile (const text_t &thegsdlhome, const text_t &theencoding,
    199             unsigned short theabsentc) {
    200     return converter.loadmapfile (thegsdlhome, theencoding, theabsentc);
     192  bool loadmapfile (const text_t &themapfile, unsigned short theabsentc) {
     193    return converter.loadmapfile (themapfile, theabsentc);
    201194  };
    202195
Note: See TracChangeset for help on using the changeset viewer.