Draft 2002-06-14

<cwctype>

The <cwctype> header is a wrapper for 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. The reverse is not necessarily true.

iswalnum function

Determines whether a wide character is alphanumeric

int iswalnum(wint_t wc)

The iswalnum function returns true if iswalpha(wc) or iswdigit(wc) is true.

See Also

iswalpha function, iswdigit function, isalnum in <cctype>

iswalpha function

Determines whether a wide character is alphabetic

int iswalpha(wint_t wc)

The iswalpha function returns true if wc is an alphabetic character, that is, a wide character for which iswcntrl, iswdigit, iswpunct, and iswspace return false.

See Also

iswcntrl function, iswdigit function, iswpunct function, iswspace function, isalpha in <cctype>

iswcntrl function

Determines whether a wide character is a control character

int iswcntrl(wint_t wc)

The iswcntrl function returns true if wc is a wide control character, that is, a wide character for which iswalnum, iswpunct, and iswspace return false.

See Also

iscntrl in <cctype>

iswctype function

Tests the type of a wide character

int iswctype(wint_t wc, wctype_t desc)

The iswctype function determines whether the wide character wc has the property desc. The setting of the LC_CTYPE category must be the same for the call to iswctype and the call to wctype that returned desc.

For example, the iswalnum function is equivalent to the following:

int iswalnum(wint_t wc)
{
  return std::iswctype(wc, std::wctype("alnum"));
}

See Also

wctype function, wctype_t type

iswdigit function

Determines whether a wide character is a digit

int iswdigit(wint_t wc)

The iswdigit function returns true if wc is a decimal digit character, that is, '0' through '9' , regardless of locale.

See Also

iswxdigit function, isdigit in <cctype>

iswgraph function

Determines whether a wide character is graphic

int iswgraph(wint_t wc)

The iswgraph function returns true if iswprint(wc) is true and iswspace(wc) is false. Note that iswgraph is slightly different from isgraph for white space characters other than ' '.

See Also

iswprint function, iswspace function

iswlower function

Determines whether a wide character is lowercase

int iswlower(wint_t wc)

The iswlower function returns true if wc is a lowercase character.

See Also

iswalpha function, iswupper function, towlower function, islower in <cctype>

iswprint function

Determines whether a wide character is printable

int iswprint(wint_t wc)

The iswprint function returns true if wc is a printing wide character.

See Also

iswgraph function, isprint in <cctype>

iswpunct function

Determines whether a wide character is punctuation

int iswpunct(wint_t wc)

The iswpunct function returns true if iswalnum(wc), iswcntrl(wc), and iswspace(wc) are false.

See Also

iswalnum function, iswcntrl function, iswspace function, ispunct in <cctype>

iswspace function

Determines whether a wide character is white space

int iswspace(wint_t wc)

The iswspace function returns true if wc is a white space character.

See Also

iswgraph function, iswprint function, isspace in <cctype>

iswupper function

Determines whether a wide character is uppercase

int iswupper(wint_t wc)

The iswupper function returns true if wc is an uppercase character.

See Also

iswalpha function, iswlower function, towupper function, isupper in <cctype>

iswxdigit function

Determines whether a wide character is a hexadecimal digit

int iswxdigit(wint_t wc)

The iswxdigit function returns true if wc is a hexadecimal digit character, that is, '0' through '9', 'a' through 'f', or 'A' though 'F', regardless of locale.

See Also

iswdigit function, isxdigit in <cctype>

towctrans function

Transform a wide character's case

wint_t towctrans(wint_t wc, wctrans_t desc)

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 as follows:

wint_t towlower(wint_t wc)
{
  return std::towctrans(wc, std::wctrans("tolower"));
}

See Also

wctrans function, wctrans_t type

towlower function

Convert a wide character to lowercase

wint_t towlower(wint_t wc)

The towlower function maps the wide character wc to lowercase. If iswupper(wc) is false, or wc has no lowercase mapping, wc is returned unchanged.

See Also

towctrans function, towupper function, tolower in <cctype>

towupper function

Convert a wide character to uppercase

wint_t towupper(wint_t wc)

The towupper function maps the wide character wc to uppercase. If iswlower(wc) is false, or wc has no uppercase mapping, wc is returned unchanged.

See Also

towctrans function, towlower function, toupper in <cctype>

wctrans function

Construct a wctrans_t object

wctrans_t wctrans(const char* property)

The wctrans function constructs a wctrans_t object according to the given property. Table 13-7 lists the properties defined in the standard.

Table 13-7. Character translation properties
Property Description
tolower Map from uppercase to lowercase
toupper Map from lowercase to uppercase

See Also

towctrans function, wctrans_t type

wctrans_t type

Represent a wide character translation

typedef ... wctrans_t

The wctrans_t type is a scalar type, used to represent character mappings for the towctrans function.

See Also

towctrans function, wctrans function, <clocale>

wctype function

Construct a wctype_t object

wctype_t wctype(const char* property)

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.

Table 13-8. Character classification properties.
Property Description
alnum Alphanumeric
alpha Alphabetic
cntrl Control
digit Digit
graph Non-space printable
lower Lowercase
print Printable or white space
punct Punctuation
space White space
upper Uppercase
xdigit Hexadecimal digit

See Also

iswctype function, wctype_t type, <clocale>

wctype_t type

Represent a character classification

typedef ... wctype_t

The wctype_t type is a scalar type, used to represent character classifications for the iswctype function.

See Also

iswctype function, wctype function, <clocale>

WEOF macro

End of file or error

const wint_t WEOF

The WEOF macro in a value that does not correspond to any valid wide character value. Unlike EOF, WEOF is not guaranteed to be negative.

See Also

WEOF in <cwchar>, EOF in <cstdio>

wint_t type

Integer representation of a wide character

typedef ... wint_t

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 Also

wint_t in <cwchar>