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

  1. #ifndef __RWLOCALE_CC
  2. #define __RWLOCALE_CC
  3. #pragma option push -b -a8 -pc -Vx- -Ve- -w-inl -w-aus -w-sig
  4. /****************************************************************************
  5.  *
  6.  * locale.cc - Definitions of the Standard Library locale classes
  7.  *
  8.  * $Id: locale.cc,v 1.67 1996/10/22 05:11:35 delaney Exp $
  9.  *
  10.  ***************************************************************************
  11.  *
  12.  * Copyright (c) 1994-1999 Rogue Wave Software, Inc.  All Rights Reserved.
  13.  *
  14.  * This computer software is owned by Rogue Wave Software, Inc. and is
  15.  * protected by U.S. copyright laws and other laws and by international
  16.  * treaties.  This computer software is furnished by Rogue Wave Software,
  17.  * Inc. pursuant to a written license agreement and may be used, copied,
  18.  * transmitted, and stored only in accordance with the terms of such
  19.  * license and with the inclusion of the above copyright notice.  This
  20.  * computer software or any other copies thereof may not be provided or
  21.  * otherwise made available to any other person.
  22.  *
  23.  * U.S. Government Restricted Rights.  This computer software is provided
  24.  * with Restricted Rights.  Use, duplication, or disclosure by the
  25.  * Government is subject to restrictions as set forth in subparagraph (c)
  26.  * (1) (ii) of The Rights in Technical Data and Computer Software clause
  27.  * at DFARS 252.227-7013 or subparagraphs (c) (1) and (2) of the
  28.  * Commercial Computer Software รป Restricted Rights at 48 CFR 52.227-19,
  29.  * as applicable.  Manufacturer is Rogue Wave Software, Inc., 5500
  30.  * Flatiron Parkway, Boulder, Colorado 80301 USA.
  31.  *
  32.  ***************************************************************************/
  33.  
  34. #ifndef __STD_RWLOCALE_IMPL__
  35. #define __STD_RWLOCALE_IMPL__
  36.  
  37. #ifndef __STD_RW_LOCNUMRW__
  38. #include <rw/numbrw>
  39. #endif
  40.  
  41. #ifndef _RWSTD_NO_NAMESPACE
  42. namespace std {
  43. #endif
  44.  
  45. // ------------------------------
  46. // Class locale member templates.
  47. // ------------------------------
  48.  
  49. // Operator () compares two strings according to the collate<charT> facet of
  50. // the locale.  It lets you use a locale object directly as a comparator
  51. // predicate for strings in various algorithms.  For instance, you can sort
  52. // a vector<string> according to the collating sequence of a locale with an
  53. // expression like: sort(v.begin(),v.end(),mylocale).
  54.  
  55. #ifndef _RWSTD_NO_MEMBER_TEMPLATES
  56. template <class charT, class Traits, class Allocator>
  57. bool locale::operator() (
  58.     const basic_string<charT,Traits,Allocator>& s1,
  59.     const basic_string<charT,Traits,Allocator>& s2) const
  60. {
  61. #ifndef _RWSTD_NO_TEMPLATE_ON_RETURN_TYPE
  62.   return use_facet<_RW_STD::collate<charT> >(*this).compare
  63.       (s1.data(),s1.data()+s1.length(),s2.data(),s2.data()+s2.length()) < 0;
  64. #else
  65.   return use_facet(*this,(_RW_STD::collate<charT>*)0).compare
  66.       (s1.data(),s1.data()+s1.length(),s2.data(),s2.data()+s2.length()) < 0;
  67. #endif
  68. }
  69. #endif // _RWSTD_NO_MEMBER_TEMPLATES
  70. #ifndef _RWSTD_NO_NAMESPACE
  71. } // namespace std
  72. #endif
  73.  
  74. #endif // __STD_RWLOCALE_IMPL__
  75. #pragma option pop
  76. #endif /* __RWLOCALE_CC */
  77.