ctype_noninline.h revision 117397
1219820Sjeff// Locale support -*- C++ -*-
2219820Sjeff
3219820Sjeff// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002
4219820Sjeff// Free Software Foundation, Inc.
5219820Sjeff//
6219820Sjeff// This file is part of the GNU ISO C++ Library.  This library is free
7219820Sjeff// software; you can redistribute it and/or modify it under the
8219820Sjeff// terms of the GNU General Public License as published by the
9219820Sjeff// Free Software Foundation; either version 2, or (at your option)
10219820Sjeff// any later version.
11219820Sjeff
12219820Sjeff// This library is distributed in the hope that it will be useful,
13219820Sjeff// but WITHOUT ANY WARRANTY; without even the implied warranty of
14219820Sjeff// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15219820Sjeff// GNU General Public License for more details.
16219820Sjeff
17219820Sjeff// You should have received a copy of the GNU General Public License along
18219820Sjeff// with this library; see the file COPYING.  If not, write to the Free
19219820Sjeff// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
20219820Sjeff// USA.
21219820Sjeff
22219820Sjeff// As a special exception, you may use this file as part of a free software
23219820Sjeff// library without restriction.  Specifically, if other files instantiate
24219820Sjeff// templates or use macros or inline functions from this file, or you compile
25219820Sjeff// this file and link it with other files to produce an executable, this
26219820Sjeff// file does not by itself cause the resulting executable to be covered by
27219820Sjeff// the GNU General Public License.  This exception does not however
28219820Sjeff// invalidate any other reasons why the executable file might be covered by
29219820Sjeff// the GNU General Public License.
30219820Sjeff
31219820Sjeff//
32219820Sjeff// ISO C++ 14882: 22.1  Locales
33219820Sjeff//
34219820Sjeff
35219820Sjeff// Information as gleaned from /usr/include/ctype.h
36219820Sjeff
37219820Sjeff  const ctype_base::mask*
38219820Sjeff  ctype<char>::classic_table() throw()
39219820Sjeff  { return __SB_masks; }
40219820Sjeff
41219820Sjeff  ctype<char>::ctype(__c_locale, const mask* __table, bool __del,
42219820Sjeff		     size_t __refs)
43219820Sjeff  : __ctype_abstract_base<char>(__refs), _M_del(__table != 0 && __del),
44255932Salfred  _M_toupper(NULL), _M_tolower(NULL),
45255932Salfred  _M_table(__table ? __table : (const mask *) __SB_masks)
46255932Salfred  { }
47255932Salfred
48255932Salfred  ctype<char>::ctype(const mask* __table, bool __del, size_t __refs)
49255932Salfred  : __ctype_abstract_base<char>(__refs), _M_del(__table != 0 && __del),
50219820Sjeff  _M_toupper(NULL), _M_tolower(NULL),
51219820Sjeff  _M_table(__table ? __table : (const mask *) __SB_masks)
52219820Sjeff  { }
53219820Sjeff
54219820Sjeff  char
55219820Sjeff  ctype<char>::do_toupper(char __c) const
56219820Sjeff  { return ::toupper((int) __c); }
57219820Sjeff
58219820Sjeff  const char*
59219820Sjeff  ctype<char>::do_toupper(char* __low, const char* __high) const
60219820Sjeff  {
61219820Sjeff    while (__low < __high)
62219820Sjeff      {
63219820Sjeff	*__low = ::toupper((int) *__low);
64255932Salfred	++__low;
65219820Sjeff      }
66219820Sjeff    return __high;
67219820Sjeff  }
68219820Sjeff
69219820Sjeff  char
70219820Sjeff  ctype<char>::do_tolower(char __c) const
71219820Sjeff  { return ::tolower((int) __c); }
72219820Sjeff
73219820Sjeff  const char*
74255932Salfred  ctype<char>::do_tolower(char* __low, const char* __high) const
75255932Salfred  {
76219820Sjeff    while (__low < __high)
77255932Salfred      {
78255932Salfred	*__low = ::tolower((int) *__low);
79255932Salfred	++__low;
80255932Salfred      }
81255932Salfred    return __high;
82255932Salfred  }
83255932Salfred