3  * Silicon Graphics Computer Systems, Inc.
 
     8  * This material is provided "as is", with absolutely no warranty expressed
 
     9  * or implied. Any use is at your own risk.
 
    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.
 
    21 // Basic framework: class locale and class locale::facet
 
    23 #ifndef _STLP_OUTERMOST_HEADER_ID
 
    24 #  define _STLP_OUTERMOST_HEADER_ID 0x1041
 
    25 #  include <stl/_prolog.h>
 
    28 #ifdef _STLP_PRAGMA_ONCE
 
    32 #include <stl/_ioserr.h>
 
    35 #ifndef _STLP_INTERNAL_CTYPE_H
 
    36 #  include <stl/_ctype.h>
 
    39 #ifndef _STLP_INTERNAL_CODECVT_H
 
    40 #  include <stl/_codecvt.h>
 
    43 #ifndef _STLP_INTERNAL_COLLATE_H
 
    44 #  include <stl/_collate.h>
 
    47 #ifndef _STLP_INTERNAL_NUM_PUT_H
 
    48 #  include <stl/_num_put.h>
 
    51 #ifndef _STLP_INTERNAL_NUM_GET_H
 
    52 #  include <stl/_num_get.h>
 
    55 // those never included separately anyway
 
    56 #include <stl/_monetary.h>
 
    57 #include <stl/_time_facets.h>
 
    58 #include <stl/_messages_facets.h>
 
    60 // some stuff for streambuf iterators ended up defined there
 
    61 // Strictly speaking, _istream.h portion is only required for <iterator>, but it may break too many
 
    62 // programs if we omit it
 
    63 #ifndef _STLP_ISTREAM_H
 
    64 #  include <stl/_istream.h>
 
    67 // Convenience interfaces
 
    84 template <class _CharT> 
 
    85 inline bool isspace (_CharT c, const locale& loc)
 
    86 { return (use_facet<ctype<_CharT> >(loc)).is(ctype_base::space, c); }
 
    88 template <class _CharT> 
 
    89 inline bool isprint (_CharT c, const locale& loc)
 
    90 { return (use_facet<ctype<_CharT> >(loc)).is(ctype_base::print, c); }
 
    92 template <class _CharT> 
 
    93 inline bool iscntrl (_CharT c, const locale& loc)
 
    94 { return (use_facet<ctype<_CharT> >(loc)).is(ctype_base::cntrl, c); }
 
    96 template <class _CharT> 
 
    97 inline bool isupper (_CharT c, const locale& loc)
 
    98 { return (use_facet<ctype<_CharT> >(loc)).is(ctype_base::upper, c); }
 
   100 template <class _CharT> 
 
   101 inline bool islower (_CharT c, const locale& loc)
 
   102 { return (use_facet<ctype<_CharT> >(loc)).is(ctype_base::lower, c); }
 
   104 template <class _CharT> 
 
   105 inline bool isalpha (_CharT c, const locale& loc)
 
   106 { return (use_facet<ctype<_CharT> >(loc)).is(ctype_base::alpha, c); }
 
   108 template <class _CharT> 
 
   109 inline bool isdigit (_CharT c, const locale& loc)
 
   110 { return (use_facet<ctype<_CharT> >(loc)).is(ctype_base::digit, c); }
 
   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); }
 
   116 template <class _CharT> 
 
   117 inline bool isxdigit (_CharT c, const locale& loc)
 
   118 { return (use_facet<ctype<_CharT> >(loc)).is(ctype_base::xdigit, c); }
 
   120 template <class _CharT> 
 
   121 inline bool isalnum (_CharT c, const locale& loc)
 
   122 { return (use_facet<ctype<_CharT> >(loc)).is(ctype_base::alnum, c); }
 
   124 template <class _CharT> 
 
   125 inline bool isgraph (_CharT c, const locale& loc)
 
   126 { return (use_facet<ctype<_CharT> >(loc)).is(ctype_base::graph, c); }
 
   128 template <class _CharT>
 
   129 inline _CharT toupper(_CharT c, const locale& loc)
 
   130 { return (use_facet<ctype<_CharT> >(loc)).toupper(c); }
 
   132 template <class _CharT>
 
   133 inline _CharT tolower(_CharT c, const locale& loc)
 
   134 { return (use_facet<ctype<_CharT> >(loc)).tolower(c); }
 
   138 #if (_STLP_OUTERMOST_HEADER_ID == 0x1041)
 
   139 #  include <stl/_epilog.h>
 
   140 #  undef _STLP_OUTERMOST_HEADER_ID
 
   143 #endif /* _STLP_LOCALE */