2 * © Portions copyright (c) 2006-2007 Nokia Corporation. All rights reserved.
5 * Silicon Graphics Computer Systems, Inc.
10 * This material is provided "as is", with absolutely no warranty expressed
11 * or implied. Any use is at your own risk.
13 * Permission to use or copy this software for any purpose is hereby granted
14 * without fee, provided the above notices are retained on all copies.
15 * Permission to modify the code and to distribute modified code is granted,
16 * provided the above notices are retained, and a notice that the code was
17 * modified is included with the above copyright notice.
23 // Basic framework: class locale and class locale::facet
25 # ifndef _STLP_OUTERMOST_HEADER_ID
26 # define _STLP_OUTERMOST_HEADER_ID 0x1041
27 # include <stl/_prolog.h>
30 # ifdef _STLP_PRAGMA_ONCE
33 # if defined (__SYMBIAN32__)
37 # if defined (_STLP_OWN_IOSTREAMS)
40 #ifndef _STLP_INTERNAL_CTYPE_H
41 #include <stl/_ctype.h>
43 #ifndef _STLP_INTERNAL_CODECVT_H
44 #include <stl/_codecvt.h>
46 #ifndef _STLP_INTERNAL_COLLATE_H
47 #include <stl/_collate.h>
49 #ifndef _STLP_INTERNAL_NUM_PUT_H
50 # include <stl/_num_put.h>
53 #ifndef _STLP_INTERNAL_NUM_GET_H
54 # include <stl/_num_get.h>
57 // those never included separately anyway
58 #include <stl/_monetary.h>
59 #include <stl/_time_facets.h>
60 #include <stl/_messages_facets.h>
62 // some stuff for streambuf iterators ended up defined there
63 // Strictly speaking, _istream.h portion is only required for <iterator>, but it may break too many
64 // programs if we omit it
65 #ifndef _STLP_ISTREAM_H
66 # include <stl/_istream.h>
69 // Convenience interfaces
86 template <class _CharT>
87 inline bool isspace (_CharT c, const locale& loc) {
88 return (use_facet<ctype<_CharT> >(loc)).is(ctype_base::space, c);
91 template <class _CharT>
92 inline bool isprint (_CharT c, const locale& loc) {
93 return (use_facet<ctype<_CharT> >(loc)).is(ctype_base::print, c);
96 template <class _CharT>
97 inline bool iscntrl (_CharT c, const locale& loc) {
98 return (use_facet<ctype<_CharT> >(loc)).is(ctype_base::cntrl, c);
101 template <class _CharT>
102 inline bool isupper (_CharT c, const locale& loc) {
103 return (use_facet<ctype<_CharT> >(loc)).is(ctype_base::upper, c);
106 template <class _CharT>
107 inline bool islower (_CharT c, const locale& loc) {
108 return (use_facet<ctype<_CharT> >(loc)).is(ctype_base::lower, c);
111 template <class _CharT>
112 inline bool isalpha (_CharT c, const locale& loc) {
113 return (use_facet<ctype<_CharT> >(loc)).is(ctype_base::alpha, c);
116 template <class _CharT>
117 inline bool isdigit (_CharT c, const locale& loc) {
118 return (use_facet<ctype<_CharT> >(loc)).is(ctype_base::digit, c);
121 template <class _CharT>
122 inline bool ispunct (_CharT c, const locale& loc) {
123 return (use_facet<ctype<_CharT> >(loc)).is(ctype_base::punct, c);
126 template <class _CharT>
127 inline bool isxdigit (_CharT c, const locale& loc) {
128 return (use_facet<ctype<_CharT> >(loc)).is(ctype_base::xdigit, c);
131 template <class _CharT>
132 inline bool isalnum (_CharT c, const locale& loc) {
133 return (use_facet<ctype<_CharT> >(loc)).is(ctype_base::alnum, c);
136 template <class _CharT>
137 inline bool isgraph (_CharT c, const locale& loc) {
138 return (use_facet<ctype<_CharT> >(loc)).is(ctype_base::graph, c);
141 template <class _CharT>
142 inline _CharT toupper(_CharT c, const locale& loc) {
143 return (use_facet<ctype<_CharT> >(loc)).toupper(c);
146 template <class _CharT>
147 inline _CharT tolower(_CharT c, const locale& loc) {
148 return (use_facet<ctype<_CharT> >(loc)).tolower(c);
151 # ifndef __LOCALE_INITIALIZED
152 # define __LOCALE_INITIALIZED
153 # if !defined(__LIBSTD_CPP_SYMBIAN32_WSD__) && !defined(_STLP_LIBSTD_CPP_NO_STATIC_VAR_)
154 // Global initializer object, to ensure initialization of locale subsystem.
155 static ios_base::_Loc_init _LocInit;
161 # elif !defined (_STLP_USE_NO_IOSTREAMS)
162 # include <wrap_std/locale>
165 # if (_STLP_OUTERMOST_HEADER_ID == 0x1041)
166 # include <stl/_epilog.h>
167 # undef _STLP_OUTERMOST_HEADER_ID
170 #endif /* _STLP_LOCALE */