ctype_noninline.h revision 117397
1117397Skan// Locale support -*- C++ -*-
2117397Skan
3117397Skan// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002
4117397Skan// Free Software Foundation, Inc.
5117397Skan//
6117397Skan// This file is part of the GNU ISO C++ Library.  This library is free
7117397Skan// software; you can redistribute it and/or modify it under the
8117397Skan// terms of the GNU General Public License as published by the
9117397Skan// Free Software Foundation; either version 2, or (at your option)
10117397Skan// any later version.
11117397Skan
12117397Skan// This library is distributed in the hope that it will be useful,
13117397Skan// but WITHOUT ANY WARRANTY; without even the implied warranty of
14117397Skan// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15117397Skan// GNU General Public License for more details.
16117397Skan
17117397Skan// You should have received a copy of the GNU General Public License along
18117397Skan// with this library; see the file COPYING.  If not, write to the Free
19117397Skan// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
20117397Skan// USA.
21117397Skan
22117397Skan// As a special exception, you may use this file as part of a free software
23117397Skan// library without restriction.  Specifically, if other files instantiate
24117397Skan// templates or use macros or inline functions from this file, or you compile
25117397Skan// this file and link it with other files to produce an executable, this
26117397Skan// file does not by itself cause the resulting executable to be covered by
27117397Skan// the GNU General Public License.  This exception does not however
28117397Skan// invalidate any other reasons why the executable file might be covered by
29117397Skan// the GNU General Public License.
30117397Skan
31117397Skan//
32117397Skan// ISO C++ 14882: 22.1  Locales
33117397Skan//
34117397Skan
35117397Skan// Information as gleaned from /usr/include/ctype.h
36117397Skan
37117397Skan  const ctype_base::mask*
38117397Skan  ctype<char>::classic_table() throw()
39117397Skan  { return __ctype_mask; }
40117397Skan
41117397Skan  ctype<char>::ctype(__c_locale, const mask* __table, bool __del,
42117397Skan		     size_t __refs)
43117397Skan  : __ctype_abstract_base<char>(__refs), _M_del(__table != 0 && __del),
44117397Skan  _M_toupper(__trans_upper), _M_tolower(__trans_lower),
45117397Skan  _M_table(__table ? __table : classic_table())
46117397Skan  { }
47117397Skan
48117397Skan  ctype<char>::ctype(const mask* __table, bool __del, size_t __refs)
49117397Skan  : __ctype_abstract_base<char>(__refs), _M_del(__table != 0 && __del),
50117397Skan  _M_toupper(__trans_upper), _M_tolower(__trans_lower),
51117397Skan  _M_table(__table ? __table : classic_table())
52117397Skan  { }
53117397Skan
54117397Skan  char
55117397Skan  ctype<char>::do_toupper(char __c) const
56117397Skan  { return _M_toupper[static_cast<unsigned char>(__c)]; }
57117397Skan
58117397Skan  const char*
59117397Skan  ctype<char>::do_toupper(char* __low, const char* __high) const
60117397Skan  {
61117397Skan    while (__low < __high)
62117397Skan      {
63117397Skan	*__low = _M_toupper[static_cast<unsigned char>(*__low)];
64117397Skan	++__low;
65117397Skan      }
66117397Skan    return __high;
67117397Skan  }
68117397Skan
69117397Skan  char
70117397Skan  ctype<char>::do_tolower(char __c) const
71117397Skan  { return _M_tolower[static_cast<unsigned char>(__c)]; }
72117397Skan
73117397Skan  const char*
74117397Skan  ctype<char>::do_tolower(char* __low, const char* __high) const
75117397Skan  {
76117397Skan    while (__low < __high)
77117397Skan      {
78117397Skan	*__low = _M_tolower[static_cast<unsigned char>(*__low)];
79117397Skan	++__low;
80117397Skan      }
81117397Skan    return __high;
82117397Skan  }
83