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