home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / stlpt453.zip / STLport-4.5.3 / stlport / locale < prev    next >
Text File  |  2001-01-26  |  4KB  |  165 lines

  1. /*
  2.  * Copyright (c) 1999
  3.  * Silicon Graphics Computer Systems, Inc.
  4.  *
  5.  * Copyright (c) 1999 
  6.  * Boris Fomitchev
  7.  *
  8.  * This material is provided "as is", with absolutely no warranty expressed
  9.  * or implied. Any use is at your own risk.
  10.  *
  11.  * Permission to use or copy this software for any purpose is hereby granted 
  12.  * without fee, provided the above notices are retained on all copies.
  13.  * Permission to modify the code and to distribute modified code is granted,
  14.  * provided the above notices are retained, and a notice that the code was
  15.  * modified is included with the above copyright notice.
  16.  *
  17.  */ 
  18. #ifndef _STLP_LOCALE
  19. #define _STLP_LOCALE
  20.  
  21. // Basic framework: class locale and class locale::facet
  22.  
  23. # ifndef _STLP_OUTERMOST_HEADER_ID
  24. #  define _STLP_OUTERMOST_HEADER_ID 0x1041
  25. #  include <stl/_prolog.h>
  26. # endif
  27.  
  28. # if defined (_STLP_OWN_IOSTREAMS)
  29.  
  30. // Individual facets
  31. #ifndef _STLP_INTERNAL_CTYPE_H
  32. #include <stl/_ctype.h>
  33. #endif
  34. #ifndef _STLP_INTERNAL_CODECVT_H
  35. #include <stl/_codecvt.h>
  36. #endif
  37. #ifndef _STLP_INTERNAL_COLLATE_H
  38. #include <stl/_collate.h>
  39. #endif
  40. #ifndef _STLP_INTERNAL_NUM_PUT_H
  41. # include <stl/_num_put.h>
  42. #endif
  43.  
  44. #ifndef _STLP_INTERNAL_NUM_GET_H
  45. # include <stl/_num_get.h>
  46. #endif
  47.  
  48. // those never included separately anyway
  49. #include <stl/_monetary.h>
  50. #include <stl/_time_facets.h>
  51. #include <stl/_messages_facets.h>
  52.  
  53. // some stuff for streambuf iterators ended up defined there
  54. // Strictly speaking, _istream.h portion is only required for <iterator>, but it may break too many 
  55. // programs if we omit it
  56. #ifndef _STLP_ISTREAM_H
  57. # include <stl/_istream.h>
  58. #endif
  59.  
  60. // Convenience interfaces
  61. #undef isspace
  62. #undef isprint
  63. #undef iscntrl
  64. #undef isupper
  65. #undef islower
  66. #undef isalpha
  67. #undef isdigit
  68. #undef ispunct
  69. #undef isxdigit
  70. #undef isalnum
  71. #undef isgraph
  72. #undef toupper
  73. #undef tolower
  74.  
  75. _STLP_BEGIN_NAMESPACE
  76.  
  77. template <class _CharT> 
  78. inline bool isspace (_CharT c, const locale& loc) {
  79.   return (use_facet<ctype<_CharT> >(loc)).is(ctype_base::space, c);
  80. }
  81.  
  82. template <class _CharT> 
  83. inline bool isprint (_CharT c, const locale& loc) {
  84.   return (use_facet<ctype<_CharT> >(loc)).is(ctype_base::print, c);
  85. }
  86.  
  87. template <class _CharT> 
  88. inline bool iscntrl (_CharT c, const locale& loc) {
  89.   return (use_facet<ctype<_CharT> >(loc)).is(ctype_base::cntrl, c);
  90. }
  91.  
  92. template <class _CharT> 
  93. inline bool isupper (_CharT c, const locale& loc) {
  94.   return (use_facet<ctype<_CharT> >(loc)).is(ctype_base::upper, c);
  95. }
  96.  
  97. template <class _CharT> 
  98. inline bool islower (_CharT c, const locale& loc) {
  99.   return (use_facet<ctype<_CharT> >(loc)).is(ctype_base::lower, c);
  100. }
  101.  
  102. template <class _CharT> 
  103. inline bool isalpha (_CharT c, const locale& loc) {
  104.   return (use_facet<ctype<_CharT> >(loc)).is(ctype_base::alpha, c);
  105. }
  106.  
  107. template <class _CharT> 
  108. inline bool isdigit (_CharT c, const locale& loc) {
  109.   return (use_facet<ctype<_CharT> >(loc)).is(ctype_base::digit, c);
  110. }
  111.  
  112. template <class _CharT> 
  113. inline bool ispunct (_CharT c, const locale& loc) {
  114.   return (use_facet<ctype<_CharT> >(loc)).is(ctype_base::punct, c);
  115. }
  116.  
  117. template <class _CharT> 
  118. inline bool isxdigit (_CharT c, const locale& loc) {
  119.   return (use_facet<ctype<_CharT> >(loc)).is(ctype_base::xdigit, c);
  120. }
  121.  
  122. template <class _CharT> 
  123. inline bool isalnum (_CharT c, const locale& loc) {
  124.   return (use_facet<ctype<_CharT> >(loc)).is(ctype_base::alnum, c);
  125. }
  126.  
  127. template <class _CharT> 
  128. inline bool isgraph (_CharT c, const locale& loc) {
  129.   return (use_facet<ctype<_CharT> >(loc)).is(ctype_base::graph, c);
  130. }
  131.  
  132. template <class _CharT>
  133. inline _CharT toupper(_CharT c, const locale& loc) {
  134.   return (use_facet<ctype<_CharT> >(loc)).toupper(c);
  135. }
  136.  
  137. template <class _CharT>
  138. inline _CharT tolower(_CharT c, const locale& loc) {
  139.   return (use_facet<ctype<_CharT> >(loc)).tolower(c);
  140. }
  141.  
  142. # ifndef __LOCALE_INITIALIZED
  143. #  define __LOCALE_INITIALIZED
  144. // Global initializer object, to ensure initialization of locale subsystem.
  145. static ios_base::_Loc_init _LocInit;
  146. # endif
  147.  
  148. _STLP_END_NAMESPACE
  149.  
  150. # elif !defined (_STLP_USE_NO_IOSTREAMS)
  151. #  include <wrap_std/locale> 
  152. # endif
  153.  
  154. # if (_STLP_OUTERMOST_HEADER_ID == 0x1041)
  155. #  include <stl/_epilog.h>
  156. #  undef _STLP_OUTERMOST_HEADER_ID
  157. # endif
  158.  
  159. #endif /* _STLP_LOCALE */
  160.  
  161.  
  162. // Local Variables:
  163. // mode:C++
  164. // End:
  165.