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