Home | History | Annotate | Download | only in stlport
      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 
     20 // Basic framework: class locale and class locale::facet
     21 
     22 #ifndef _STLP_OUTERMOST_HEADER_ID
     23 #  define _STLP_OUTERMOST_HEADER_ID 0x1041
     24 #  include <stl/_prolog.h>
     25 #  define _STLP_LOCALE
     26 #endif
     27 
     28 #if (_STLP_OUTERMOST_HEADER_ID == 0x1041) && \
     29    !(defined (_STLP_NO_IOSTREAMS) && defined (_STLP_IMPORT_VENDOR_STD))
     30 #  include <stl/_ioserr.h>
     31 
     32 // Individual facets
     33 #  ifndef _STLP_INTERNAL_CTYPE_H
     34 #    include <stl/_ctype.h>
     35 #  endif
     36 
     37 #  ifndef _STLP_INTERNAL_CODECVT_H
     38 #    include <stl/_codecvt.h>
     39 #  endif
     40 
     41 #  ifndef _STLP_INTERNAL_COLLATE_H
     42 #    include <stl/_collate.h>
     43 #  endif
     44 
     45 #  ifndef _STLP_INTERNAL_NUM_PUT_H
     46 #    include <stl/_num_put.h>
     47 #  endif
     48 
     49 #  ifndef _STLP_INTERNAL_NUM_GET_H
     50 #    include <stl/_num_get.h>
     51 #  endif
     52 
     53 // those never included separately anyway
     54 #  include <stl/_monetary.h>
     55 #  include <stl/_time_facets.h>
     56 #  include <stl/_messages_facets.h>
     57 
     58 // some stuff for streambuf iterators ended up defined there
     59 // Strictly speaking, _istream.h portion is only required for <iterator>, but it may break too many
     60 // programs if we omit it
     61 #  ifndef _STLP_ISTREAM_H
     62 #    include <stl/_istream.h>
     63 #  endif
     64 
     65 // Convenience interfaces
     66 #undef isspace
     67 #undef isprint
     68 #undef iscntrl
     69 #undef isupper
     70 #undef islower
     71 #undef isalpha
     72 #undef isdigit
     73 #undef ispunct
     74 #undef isxdigit
     75 #undef isalnum
     76 #undef isgraph
     77 #undef toupper
     78 #undef tolower
     79 
     80 _STLP_BEGIN_NAMESPACE
     81 
     82 template <class _CharT>
     83 inline bool isspace (_CharT c, const locale& loc)
     84 { return (use_facet<ctype<_CharT> >(loc)).is(ctype_base::space, c); }
     85 
     86 template <class _CharT>
     87 inline bool isprint (_CharT c, const locale& loc)
     88 { return (use_facet<ctype<_CharT> >(loc)).is(ctype_base::print, c); }
     89 
     90 template <class _CharT>
     91 inline bool iscntrl (_CharT c, const locale& loc)
     92 { return (use_facet<ctype<_CharT> >(loc)).is(ctype_base::cntrl, c); }
     93 
     94 template <class _CharT>
     95 inline bool isupper (_CharT c, const locale& loc)
     96 { return (use_facet<ctype<_CharT> >(loc)).is(ctype_base::upper, c); }
     97 
     98 template <class _CharT>
     99 inline bool islower (_CharT c, const locale& loc)
    100 { return (use_facet<ctype<_CharT> >(loc)).is(ctype_base::lower, c); }
    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 template <class _CharT>
    107 inline bool isdigit (_CharT c, const locale& loc)
    108 { return (use_facet<ctype<_CharT> >(loc)).is(ctype_base::digit, c); }
    109 
    110 template <class _CharT>
    111 inline bool ispunct (_CharT c, const locale& loc)
    112 { return (use_facet<ctype<_CharT> >(loc)).is(ctype_base::punct, c); }
    113 
    114 template <class _CharT>
    115 inline bool isxdigit (_CharT c, const locale& loc)
    116 { return (use_facet<ctype<_CharT> >(loc)).is(ctype_base::xdigit, c); }
    117 
    118 template <class _CharT>
    119 inline bool isalnum (_CharT c, const locale& loc)
    120 { return (use_facet<ctype<_CharT> >(loc)).is(ctype_base::alnum, c); }
    121 
    122 template <class _CharT>
    123 inline bool isgraph (_CharT c, const locale& loc)
    124 { return (use_facet<ctype<_CharT> >(loc)).is(ctype_base::graph, c); }
    125 
    126 template <class _CharT>
    127 inline _CharT toupper(_CharT c, const locale& loc)
    128 { return (use_facet<ctype<_CharT> >(loc)).toupper(c); }
    129 
    130 template <class _CharT>
    131 inline _CharT tolower(_CharT c, const locale& loc)
    132 { return (use_facet<ctype<_CharT> >(loc)).tolower(c); }
    133 
    134 _STLP_END_NAMESPACE
    135 
    136 #endif
    137 
    138 #if (_STLP_OUTERMOST_HEADER_ID != 0x1041) || defined (_STLP_IMPORT_VENDOR_STD)
    139 #  if defined (_STLP_HAS_INCLUDE_NEXT)
    140 #    include_next <locale>
    141 #  else
    142 #    include _STLP_NATIVE_HEADER(locale)
    143 #  endif
    144 #endif
    145 
    146 #if (_STLP_OUTERMOST_HEADER_ID == 0x1041)
    147 #  include <stl/_epilog.h>
    148 #  undef _STLP_OUTERMOST_HEADER_ID
    149 #endif
    150 
    151 #endif /* _STLP_LOCALE */
    152 
    153 
    154 // Local Variables:
    155 // mode:C++
    156 // End:
    157