home *** CD-ROM | disk | FTP | other *** search
/ PC Format (South-Africa) 2001 June / PCFJune.iso / Xenon / C++ / FreeCommandLineTools.exe / Include / Rw / locimpl.cc < prev    next >
Encoding:
C/C++ Source or Header  |  2000-01-31  |  2.6 KB  |  70 lines

  1. #ifndef __LOCIMPL_CC
  2. #define __LOCIMPL_CC
  3. #pragma option push -b -a8 -pc -Vx- -Ve- -w-inl -w-aus -w-sig
  4. /***************************************************************************
  5.  *
  6.  * rw/locimpl.cc - Template definitions for the Standard Library locale
  7.  *                 private implementation classes.
  8.  *
  9.  ***************************************************************************
  10.  *
  11.  * Copyright (c) 1994-1999 Rogue Wave Software, Inc.  All Rights Reserved.
  12.  *
  13.  * This computer software is owned by Rogue Wave Software, Inc. and is
  14.  * protected by U.S. copyright laws and other laws and by international
  15.  * treaties.  This computer software is furnished by Rogue Wave Software,
  16.  * Inc. pursuant to a written license agreement and may be used, copied,
  17.  * transmitted, and stored only in accordance with the terms of such
  18.  * license and with the inclusion of the above copyright notice.  This
  19.  * computer software or any other copies thereof may not be provided or
  20.  * otherwise made available to any other person.
  21.  *
  22.  * U.S. Government Restricted Rights.  This computer software is provided
  23.  * with Restricted Rights.  Use, duplication, or disclosure by the
  24.  * Government is subject to restrictions as set forth in subparagraph (c)
  25.  * (1) (ii) of The Rights in Technical Data and Computer Software clause
  26.  * at DFARS 252.227-7013 or subparagraphs (c) (1) and (2) of the
  27.  * Commercial Computer Software รป Restricted Rights at 48 CFR 52.227-19,
  28.  * as applicable.  Manufacturer is Rogue Wave Software, Inc., 5500
  29.  * Flatiron Parkway, Boulder, Colorado 80301 USA.
  30.  *
  31.  **************************************************************************/
  32.  
  33. #ifndef _RWSTD_NO_NAMESPACE
  34. namespace __rwstd {
  35. #endif
  36.  
  37. // -------------------------------------------
  38. // Template digit_map<charT> member templates.
  39. // -------------------------------------------
  40.  
  41. template <class charT>
  42. void 
  43. digit_map<charT>::init (const _RW_STD::ctype<charT> &ct)
  44. {
  45.   ct.widen(punct_chars,punct_chars+sizeof punct_chars,punct_array);
  46.   ct.widen(digit_chars,digit_chars+sizeof digit_chars,digit_array);
  47.  
  48. #if !defined(_RWSTD_NO_NEW_HEADER) && !defined(_RWSTD_NO_NAMESPACE)
  49.   std::memcpy(value_array,char_values,sizeof value_array);
  50. #else
  51.   memcpy(value_array,char_values,sizeof value_array);
  52. #endif
  53.   inited=true;
  54. }
  55.  
  56. template <class charT>
  57. int digit_map<charT>::eval (charT c) const {
  58.   const charT *end=digit_array+sizeof value_array;
  59.   for (const charT *p=digit_array; p<end; p++)
  60.     if (*p==c)
  61.       return value_array[p-digit_array];
  62.   return -1;
  63. }
  64. #ifndef _RWSTD_NO_NAMESPACE
  65. } // namespace __rwstd
  66. #endif
  67.  
  68. #pragma option pop
  69. #endif /* __LOCIMPL_CC */
  70.