SysTutorials

Linux Manual Pages › Section 3

stdctype_byname(3)

std::ctype_byname<char> – std::ctype_byname<char>

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

              constructs a new ctype_byname<char> facet
constructor (public member function)
              destructs a ctype_byname<char> facet
destructor (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

              obtains the character classification table
table (public member function of std::ctype<char>)

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

Protected member functions

do_toupper converts a character or characters to uppercase
           (virtual protected member function of std::ctype<CharT>)
[virtual]

do_tolower converts a character or characters to lowercase
           (virtual protected member function of std::ctype<CharT>)
[virtual]

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

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

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
                 (public static member constant)
[static]

print the value of mask identifying printable character classification
                 (public static member constant)
[static]

cntrl the value of mask identifying control character classification
                 (public static member constant)
[static]

upper the value of mask identifying uppercase character classification
                 (public static member constant)
[static]

lower the value of mask identifying lowercase character classification
                 (public static member constant)
[static]

alpha the value of mask identifying alphabetic character classification
                 (public static member constant)
[static]

digit the value of mask identifying digit character classification
                 (public static member constant)
[static]

punct the value of mask identifying punctuation character classification
                 (public static member constant)
[static]

xdigit the value of mask identifying hexadecimal digit character classification
                 (public static member constant)
[static]

blank the value of mask identifying blank character classification
                 (public static member constant)
[static] (C++11)

alnum alpha | digit
                 (public static member constant)
[static]

graph alnum | punct
                 (public static member constant)
[static]

Example

// Run this code

#include <iostream>
#include <locale>
int main()
{
    char c = '�'; // capital letter thorn
    std::locale loc("C");
    std::cout << "isupper('Þ', C locale) returned "
              << std::boolalpha << std::isupper(c, loc) << '
';
    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) << '
';
    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) << '
';
}

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

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