Changeset 413
- Timestamp:
- 1999-07-21T19:23:18+12:00 (25 years ago)
- Location:
- trunk/gsdl/lib
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gsdl/lib/gsdlunicode.cpp
r329 r413 12 12 /* 13 13 $Log$ 14 Revision 1.9 1999/07/21 07:23:17 rjmcnab 15 Added setmapfile function to map conversion utilities so the map file 16 does not need to be loaded when map conversion object is created. 17 14 18 Revision 1.8 1999/07/01 04:03:45 rjmcnab 15 19 Optimised utf8inconvertclass::convert slightly. … … 259 263 } 260 264 265 // setmapfile will cause loadmapfile to be called when conversion is 266 // needed 267 bool mapconvert::setmapfile (const text_t &thegsdlhome, const text_t &theencoding, 268 unsigned short theabsentc) { 269 // check to see if the mapfile has been already loaded 270 if (mapdata.loaded && gsdlhome == thegsdlhome && 271 encoding == theencoding && absentc == theabsentc) 272 return true; 273 274 unloadmapfile (); 275 gsdlhome = thegsdlhome; 276 encoding = theencoding; 277 absentc = theabsentc; 278 279 return true; 280 } 281 282 261 283 262 284 // loadmapfile should be called before any conversion is done … … 338 360 339 361 unsigned short mapconvert::convert (unsigned short c) { 340 if (!mapdata.loaded) return absentc; 362 if (!mapdata.loaded) { 363 if (!gsdlhome.empty() && !encoding.empty() && 364 loadmapfile (gsdlhome, encoding, absentc)) { 365 // do nothing, successfully loaded database 366 } else return absentc; 367 } 341 368 342 369 if (c == 0) return 0; // 0 always maps to 0... -
trunk/gsdl/lib/gsdlunicode.h
r320 r413 98 98 ~mapconvert () {unloadmapfile();}; 99 99 100 // setmapfile will cause loadmapfile to be called when conversion is 101 // needed 102 bool setmapfile (const text_t &thegsdlhome, const text_t &theencoding, 103 unsigned short theabsentc); 104 100 105 // loadmapfile should be called before any conversion is done 101 106 bool loadmapfile (const text_t &thegsdlhome, const text_t &theencoding, … … 125 130 mapinconvertclass(); 126 131 virtual ~mapinconvertclass() {}; 132 133 // setmapfile will cause loadmapfile to be called when conversion is needed 134 bool setmapfile (const text_t &thegsdlhome, const text_t &theencoding, 135 unsigned short theabsentc) { 136 return converter.setmapfile (thegsdlhome, theencoding, theabsentc); 137 }; 127 138 128 139 // loadmapfile should be called before any conversion takes … … 163 174 virtual ~mapoutconvertclass() {}; 164 175 176 // setmapfile will cause loadmapfile to be called when conversion is needed 177 bool setmapfile (const text_t &thegsdlhome, const text_t &theencoding, 178 unsigned short theabsentc) { 179 return converter.setmapfile (thegsdlhome, theencoding, theabsentc); 180 }; 181 165 182 // loadmapfile should be called before any conversion takes 166 183 // place
Note:
See TracChangeset
for help on using the changeset viewer.