3 // Copyright (C) 2000 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, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
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.
30 // 22.2.1.3.2 ctype<char> members
33 // NB: Don't include any other headers in this file.
38 class gnu_ctype: public std::ctype<char> {};
43 const char strlit00[] = "manilla, cebu, tandag PHILIPPINES";
44 const char strlit01[] = "MANILLA, CEBU, TANDAG PHILIPPINES";
45 const char strlit02[] = "manilla, cebu, tandag philippines";
58 int len = std::char_traits<char>::length(strlit00);
59 char c_array[len + 1];
61 // bool is(mask m, char c) const;
62 test &= gctype.is(std::ctype_base::space, c30);
63 test &= gctype.is(std::ctype_base::upper, c00);
64 test &= gctype.is(std::ctype_base::lower, c10);
65 test &= gctype.is(std::ctype_base::digit, c20);
66 test &= gctype.is(std::ctype_base::punct, c40);
67 test &= gctype.is(std::ctype_base::alpha, c50);
68 test &= gctype.is(std::ctype_base::alpha, c60);
69 test &= gctype.is(std::ctype_base::xdigit, c20);
70 test &= !gctype.is(std::ctype_base::xdigit, c80);
71 test &= gctype.is(std::ctype_base::alnum, c50);
72 test &= gctype.is(std::ctype_base::alnum, c20);
73 test &= gctype.is(std::ctype_base::graph, c40);
74 test &= gctype.is(std::ctype_base::graph, c20);
76 // char toupper(char c) const
77 c100 = gctype.toupper(c10);
80 // char tolower(char c) const
81 c100 = gctype.tolower(c00);
84 // char toupper(char* low, const char* hi) const
85 std::char_traits<char>::copy(c_array, strlit02, len + 1);
86 gctype.toupper(c_array, c_array + len);
87 test &= !std::char_traits<char>::compare(c_array, strlit01, len - 1);
89 // char tolower(char* low, const char* hi) const
90 std::char_traits<char>::copy(c_array, strlit01, len + 1);
91 gctype.tolower(c_array, c_array + len);
92 test &= !std::char_traits<char>::compare(c_array, strlit02, len - 1);