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