Scroll to navigation

std::ctype_byname(3) C++ Standard Libary std::ctype_byname(3)

NAME

std::ctype_byname - std::ctype_byname

Synopsis


Defined in header <locale>
template<>
class ctype_byname : public std::ctype<char>;


This specialization of std::ctype_byname encapsulates character classification
features for type char. Like its base class std::ctype<char> and unlike
general-purpose std::ctype_byname, table lookup is used to classify characters

Member types


Member type Definition
mask ctype<char>::mask

Member functions


constructor constructs a new ctype_byname<char> facet
(public member function)
destructor destructs a ctype_byname<char> facet
(protected member function)

Inherited from std::ctype<char>

Member types


Member type Definition
char_type char

Member objects


Member name Type
id (static) std::locale::id
table_size (static const) std::size_t size of the classification table, at least 256

Member functions


table obtains the character classification table
(public member function of std::ctype<char>)
classic_table obtains the "C" locale character classification table
[static] (public static member function of std::ctype<char>)
classifies a character or a character sequence, using the
is classification table
(public member function of std::ctype<char>)
locates the first character in a sequence that conforms to given
scan_is classification, using the classification table
(public member function of std::ctype<char>)
locates the first character in a sequence that fails given
scan_not classification, using the classification table
(public member function of std::ctype<char>)
toupper invokes do_toupper
(public member function of std::ctype<CharT>)
tolower invokes do_tolower
(public member function of std::ctype<CharT>)
widen invokes do_widen
(public member function of std::ctype<CharT>)
narrow invokes do_narrow
(public member function of std::ctype<CharT>)

Protected member functions


do_toupper converts a character or characters to uppercase
[virtual] (virtual protected member function of std::ctype<CharT>)
do_tolower converts a character or characters to lowercase
[virtual] (virtual protected member function of std::ctype<CharT>)
do_widen converts a character or characters from char to CharT
[virtual] (virtual protected member function of std::ctype<CharT>)
do_narrow converts a character or characters from CharT to char
[virtual] (virtual protected member function of std::ctype<CharT>)

Inherited from std::ctype_base

Member types


Type Definition
mask unspecified bitmask type (enumeration, integer type, or bitset)

Member constants


space the value of mask identifying whitespace character classification
[static] (public static member constant)
print the value of mask identifying printable character classification
[static] (public static member constant)
cntrl the value of mask identifying control character classification
[static] (public static member constant)
upper the value of mask identifying uppercase character classification
[static] (public static member constant)
lower the value of mask identifying lowercase character classification
[static] (public static member constant)
alpha the value of mask identifying alphabetic character classification
[static] (public static member constant)
digit the value of mask identifying digit character classification
[static] (public static member constant)
punct the value of mask identifying punctuation character classification
[static] (public static member constant)
xdigit the value of mask identifying hexadecimal digit character
[static] classification
(public static member constant)
blank the value of mask identifying blank character classification
[static] (C++11) (public static member constant)
alnum alpha | digit
[static] (public static member constant)
graph alnum | punct
[static] (public static member constant)

Example

// Run this code


#include <iostream>
#include <locale>


int main()
{
char c = '\xde'; // capital letter thorn


std::locale loc("C");


std::cout << "isupper('Þ', C locale) returned "
<< std::boolalpha << std::isupper(c, loc) << '\n';


loc = std::locale(loc, new std::ctype_byname<char>("en_US.utf8"));


std::cout << "isupper('Þ', C locale with Unicode ctype<char>) returned "
<< std::boolalpha << std::isupper(c, loc) << '\n';


loc = std::locale(loc, new std::ctype_byname<char>("is_IS.iso88591"));


std::cout << "isupper('Þ', C locale with Islandic ctype<char>) returned "
<< std::boolalpha << std::isupper(c, loc) << '\n';
}

Output:


isupper('Þ', C locale) returned false
isupper('Þ', C locale with Unicode ctype<char>) returned false
isupper('Þ', C locale with Islandic ctype<char>) returned true

See also


ctype defines character classification tables
(class template)
ctype<char> specialization of std::ctype for type char
(class template specialization)

2024.06.10 http://cppreference.com