13.21 <cwctype>The <cwctype> header is the C++ version of the C standard <wctype.h> header, which declares types and functions for classifying and converting wide characters. Most of the functions in this header are wide equivalents of functions found in <cctype>. For example, iswalnum determines whether a wide character is alphanumeric, just as isalnum determines whether a narrow (byte) character is alphanumeric. The behavior of the wide functions is similar to their narrow equivalents. In particular, for any narrow character c, its wide character equivalent wc, and classification functions isxyz and iswxyx, if isxyz(c) is true, then iswxyz(wc) is true and vice versa. The only exception is that iswgraph and iswpunct behave slightly differently than isgraph and ispunct for whitespace characters other than ' '. The behavior of the <cwctype> functions depend on the C locale, as set with the setlocale function in <clocale>. For more flexibility in dealing with multiple locales, you can use C++ locales, in particular the ctype facet in <locale>.
The iswalnum function returns true (nonzero) if either iswalpha(wc) or iswdigit(wc) is true. See Alsoiswalpha function, iswdigit function, isalnum in <cctype>
The iswalpha function returns true (nonzero) if wc is an alphabetic character, that is, a wide character for which iswcntrl, iswdigit, iswpunct, and iswspace all return false (0). See Alsoiswcntrl function, iswdigit function, iswpunct function, iswspace function, isalpha in <cctype>
The iswcntrl function returns true (nonzero) if wc is a wide control character, that is, a wide character for which iswalnum, iswpunct, and iswspace all return false (0). See Alsoiswalnum function, iswpunct function, iswspace function, iscntrl in <cctype>
The iswctype function tests any category of the wide character wc. The category to test is specified by desc, which must be obtained by calling wctype. The setting of the LC_CTYPE category must be the same for the call to iswctype and the call to wctype that returned desc. Using iswctype, you can implement all the isw . . . functions. For example, you can implement the iswalnum function as follows: int iswalnum(wint_t wc) { return std::iswctype(wc, std::wctype("alnum")); } See Alsowctype function, wctype_t type
The iswdigit function returns true (nonzero) if wc is a decimal digit character—that is, '0'-'9'—regardless of locale. See Alsoiswxdigit function, isdigit in <cctype>
The iswgraph function returns true (nonzero) if iswprint(wc) is true and iswspace(wc) is false. Note that iswgraph is slightly different from isgraph in that it returns true for whitespace characters other than ' '. See Alsoiswprint function, iswspace function
The iswlower function returns true (nonzero) if wc is a lowercase character. See Alsoiswalpha function, iswupper function, towlower function, islower in <cctype>
The iswprint function returns true (nonzero) if wc is a printable wide character. See Alsoiswgraph function, isprint in <cctype>
The iswpunct function returns true (nonzero) if iswalnum(wc), iswcntrl(wc), and iswspace(wc) are false. See Alsoiswalnum function, iswcntrl function, iswspace function, ispunct in <cctype>
The iswspace function returns true (nonzero) if wc is a whitespace character. See Alsoiswgraph function, iswprint function, isspace in <cctype>
The iswupper function returns true (nonzero) if wc is an uppercase character. See Alsoiswalpha function, iswlower function, towupper function, isupper in <cctype>
The iswxdigit function returns true (nonzero) if wc is a hexadecimal digit character—that is, '0'-'9', 'a'-'f', or 'A'-'F'—regardless of locale. See Alsoiswdigit function, isxdigit in <cctype>
The towctrans function translates the wide character wc according to the description desc, which was returned from the wctrans function. For example, the towlower function can be implemented using towctrans: wint_t towlower(wint_t wc) { return std::towctrans(wc, std::wctrans("tolower")); } See Alsowctrans function, wctrans_t type
The towlower function maps the wide character wc to lowercase. If iswupper(wc) is false, or if wc has no lowercase mapping, wc is returned unchanged. See Alsotowctrans function, towupper function, tolower in <cctype>
The towupper function maps the wide character wc to uppercase. If iswlower(wc) is false, or if wc has no uppercase mapping, wc is returned unchanged. See Alsotowctrans function, towlower function, toupper in <cctype>
The wctrans function constructs a wctrans_t object according to the given property. Table 13-7 lists the properties defined in the standard.
See Alsotowctrans function, wctrans_t type
The wctrans_t type is a scalar type used to represent character mappings for the towctrans function. See Alsotowctrans function, wctrans function, <clocale>
The wctype function constructs a wctype_t object that describes wide characters that have the given property. Table 13-8 lists the properties that are supported by this standard.
See Alsoiswctype function, wctype_t type, <clocale>
The wctype_t type is a scalar type used to represent character classifications for the iswctype function. See Alsoiswctype function, wctype function, <clocale>
The WEOF macro expands to a constant integer value that does not correspond to any valid wide character value. Unlike EOF, WEOF is not guaranteed to be negative. See AlsoWEOF in <cwchar>, EOF in <cstdio>
The wint_t type is an integral type that represents wide characters. It can hold the value for any character in the extended character set plus the value WEOF. See Alsowint_t in <cwchar> |