1 // Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2004, 2005,
3 // Free Software Foundation, Inc.
5 // This file is part of the GNU ISO C++ Library. This library is free
6 // software; you can redistribute it and/or modify it under the
7 // terms of the GNU General Public License as published by the
8 // Free Software Foundation; either version 2, or (at your option)
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
16 // You should have received a copy of the GNU General Public License along
17 // with this library; see the file COPYING. If not, write to the Free
18 // Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
21 // As a special exception, you may use this file as part of a free software
22 // library without restriction. Specifically, if other files instantiate
23 // templates or use macros or inline functions from this file, or you compile
24 // this file and link it with other files to produce an executable, this
25 // file does not by itself cause the resulting executable to be covered by
26 // the GNU General Public License. This exception does not however
27 // invalidate any other reasons why the executable file might be covered by
28 // the GNU General Public License.
33 _GLIBCXX_BEGIN_NAMESPACE(std
)
35 // Definitions for static const data members of ctype_base.
36 const ctype_base::mask
ctype_base::space
;
37 const ctype_base::mask
ctype_base::print
;
38 const ctype_base::mask
ctype_base::cntrl
;
39 const ctype_base::mask
ctype_base::upper
;
40 const ctype_base::mask
ctype_base::lower
;
41 const ctype_base::mask
ctype_base::alpha
;
42 const ctype_base::mask
ctype_base::digit
;
43 const ctype_base::mask
ctype_base::punct
;
44 const ctype_base::mask
ctype_base::xdigit
;
45 const ctype_base::mask
ctype_base::alnum
;
46 const ctype_base::mask
ctype_base::graph
;
48 // Definitions for locale::id of standard facets that are specialized.
49 locale::id ctype
<char>::id
;
51 #ifdef _GLIBCXX_USE_WCHAR_T
52 locale::id ctype
<wchar_t>::id
;
57 use_facet
<ctype
<char> >(const locale
& __loc
)
59 size_t __i
= ctype
<char>::id
._M_id();
60 const locale::_Impl
* __tmp
= __loc
._M_impl
;
61 return static_cast<const ctype
<char>&>(*(__tmp
->_M_facets
[__i
]));
64 #ifdef _GLIBCXX_USE_WCHAR_T
67 use_facet
<ctype
<wchar_t> >(const locale
& __loc
)
69 size_t __i
= ctype
<wchar_t>::id
._M_id();
70 const locale::_Impl
* __tmp
= __loc
._M_impl
;
71 return static_cast<const ctype
<wchar_t>&>(*(__tmp
->_M_facets
[__i
]));
75 // XXX At some point, just rename this file to ctype_configure_char.cc
76 // and compile it as a separate file instead of including it here.
77 // Platform-specific initialization code for ctype tables.
78 #include <bits/ctype_noninline.h>
80 const size_t ctype
<char>::table_size
;
84 _S_destroy_c_locale(_M_c_locale_ctype
);
86 delete[] this->table();
89 #ifdef _GLIBCXX_USE_WCHAR_T
90 ctype
<wchar_t>::ctype(size_t __refs
)
91 : __ctype_abstract_base
<wchar_t>(__refs
),
92 _M_c_locale_ctype(_S_get_c_locale()), _M_narrow_ok(false)
93 { _M_initialize_ctype(); }
95 ctype
<wchar_t>::ctype(__c_locale __cloc
, size_t __refs
)
96 : __ctype_abstract_base
<wchar_t>(__refs
),
97 _M_c_locale_ctype(_S_clone_c_locale(__cloc
)), _M_narrow_ok(false)
98 { _M_initialize_ctype(); }
100 ctype
<wchar_t>::~ctype()
101 { _S_destroy_c_locale(_M_c_locale_ctype
); }
103 ctype_byname
<wchar_t>::ctype_byname(const char* __s
, size_t __refs
)
104 : ctype
<wchar_t>(__refs
)
106 if (std::strcmp(__s
, "C") != 0 && std::strcmp(__s
, "POSIX") != 0)
108 this->_S_destroy_c_locale(this->_M_c_locale_ctype
);
109 this->_S_create_c_locale(this->_M_c_locale_ctype
, __s
);
110 this->_M_initialize_ctype();
114 ctype_byname
<wchar_t>::~ctype_byname()
119 _GLIBCXX_END_NAMESPACE