genericopenlibs/cppstdlib/stl/stlport/locale
changeset 0 e4d67989cc36
equal deleted inserted replaced
-1:000000000000 0:e4d67989cc36
       
     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 #ifdef _STLP_PRAGMA_ONCE
       
    29 #  pragma once
       
    30 #endif
       
    31 
       
    32 #include <stl/_ioserr.h>
       
    33 
       
    34 // Individual facets
       
    35 #ifndef _STLP_INTERNAL_CTYPE_H
       
    36 #  include <stl/_ctype.h>
       
    37 #endif
       
    38 
       
    39 #ifndef _STLP_INTERNAL_CODECVT_H
       
    40 #  include <stl/_codecvt.h>
       
    41 #endif
       
    42 
       
    43 #ifndef _STLP_INTERNAL_COLLATE_H
       
    44 #  include <stl/_collate.h>
       
    45 #endif
       
    46 
       
    47 #ifndef _STLP_INTERNAL_NUM_PUT_H
       
    48 #  include <stl/_num_put.h>
       
    49 #endif
       
    50 
       
    51 #ifndef _STLP_INTERNAL_NUM_GET_H
       
    52 #  include <stl/_num_get.h>
       
    53 #endif
       
    54 
       
    55 // those never included separately anyway
       
    56 #include <stl/_monetary.h>
       
    57 #include <stl/_time_facets.h>
       
    58 #include <stl/_messages_facets.h>
       
    59 
       
    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>
       
    65 #endif
       
    66 
       
    67 // Convenience interfaces
       
    68 #undef isspace
       
    69 #undef isprint
       
    70 #undef iscntrl
       
    71 #undef isupper
       
    72 #undef islower
       
    73 #undef isalpha
       
    74 #undef isdigit
       
    75 #undef ispunct
       
    76 #undef isxdigit
       
    77 #undef isalnum
       
    78 #undef isgraph
       
    79 #undef toupper
       
    80 #undef tolower
       
    81 
       
    82 _STLP_BEGIN_NAMESPACE
       
    83 
       
    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); }
       
    87 
       
    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); }
       
    91 
       
    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); }
       
    95 
       
    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); }
       
    99 
       
   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); }
       
   103 
       
   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); }
       
   107 
       
   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); }
       
   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 template <class _CharT> 
       
   117 inline bool isxdigit (_CharT c, const locale& loc)
       
   118 { return (use_facet<ctype<_CharT> >(loc)).is(ctype_base::xdigit, c); }
       
   119 
       
   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); }
       
   123 
       
   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); }
       
   127 
       
   128 template <class _CharT>
       
   129 inline _CharT toupper(_CharT c, const locale& loc)
       
   130 { return (use_facet<ctype<_CharT> >(loc)).toupper(c); }
       
   131 
       
   132 template <class _CharT>
       
   133 inline _CharT tolower(_CharT c, const locale& loc)
       
   134 { return (use_facet<ctype<_CharT> >(loc)).tolower(c); }
       
   135 
       
   136 _STLP_END_NAMESPACE
       
   137 
       
   138 #if (_STLP_OUTERMOST_HEADER_ID == 0x1041)
       
   139 #  include <stl/_epilog.h>
       
   140 #  undef _STLP_OUTERMOST_HEADER_ID
       
   141 #endif
       
   142 
       
   143 #endif /* _STLP_LOCALE */
       
   144 
       
   145 
       
   146 // Local Variables:
       
   147 // mode:C++
       
   148 // End: