.TH "std::regex_traits< _Ch_type >" 3cxx "Tue Jul 18 2023" "libstdc++" \" -*- nroff -*- .ad l .nh .SH NAME std::regex_traits< _Ch_type > \- Describes aspects of a regular expression\&. .SH SYNOPSIS .br .PP .PP \fC#include \fP .SS "Public Types" .in +1c .ti -1c .RI "typedef _RegexMask \fBchar_class_type\fP" .br .ti -1c .RI "typedef _Ch_type \fBchar_type\fP" .br .ti -1c .RI "typedef \fBstd::locale\fP \fBlocale_type\fP" .br .ti -1c .RI "typedef \fBstd::basic_string\fP< char_type > \fBstring_type\fP" .br .in -1c .SS "Public Member Functions" .in +1c .ti -1c .RI "\fBregex_traits\fP ()" .br .RI "Constructs a default traits object\&. " .ti -1c .RI "\fBlocale_type\fP \fBgetloc\fP () const" .br .RI "Gets a copy of the current locale in use by the regex_traits object\&. " .ti -1c .RI "\fBlocale_type\fP \fBimbue\fP (\fBlocale_type\fP __loc)" .br .RI "Imbues the regex_traits object with a copy of a new locale\&. " .ti -1c .RI "bool \fBisctype\fP (_Ch_type __c, char_class_type __f) const" .br .RI "Determines if \fCc\fP is a member of an identified class\&. " .ti -1c .RI "template char_class_type \fBlookup_classname\fP (_Fwd_iter __first, _Fwd_iter __last, bool __icase=false) const" .br .RI "Maps one or more characters to a named character classification\&. " .ti -1c .RI "template \fBstring_type\fP \fBlookup_collatename\fP (_Fwd_iter __first, _Fwd_iter __last) const" .br .RI "Gets a collation element by name\&. " .ti -1c .RI "template \fBstring_type\fP \fBtransform\fP (_Fwd_iter __first, _Fwd_iter __last) const" .br .RI "Gets a sort key for a character sequence\&. " .ti -1c .RI "template \fBstring_type\fP \fBtransform_primary\fP (_Fwd_iter __first, _Fwd_iter __last) const" .br .RI "Gets a sort key for a character sequence, independent of case\&. " .ti -1c .RI "char_type \fBtranslate\fP (char_type __c) const" .br .RI "Performs the identity translation\&. " .ti -1c .RI "char_type \fBtranslate_nocase\fP (char_type __c) const" .br .RI "Translates a character into a case-insensitive equivalent\&. " .ti -1c .RI "int \fBvalue\fP (_Ch_type __ch, int __radix) const" .br .RI "Converts a digit to an int\&. " .in -1c .SS "Static Public Member Functions" .in +1c .ti -1c .RI "static std::size_t \fBlength\fP (const char_type *__p)" .br .RI "Gives the length of a C-style string starting at \fC__p\fP\&. " .in -1c .SS "Protected Attributes" .in +1c .ti -1c .RI "\fBlocale_type\fP \fB_M_locale\fP" .br .in -1c .SH "Detailed Description" .PP .SS "template .br class std::regex_traits< _Ch_type >"Describes aspects of a regular expression\&. A regular expression traits class that satisfies the requirements of section [28\&.7]\&. .PP The class regex is parameterized around a set of related types and functions used to complete the definition of its semantics\&. This class satisfies the requirements of such a traits class\&. .SH "Constructor & Destructor Documentation" .PP .SS "template \fBstd::regex_traits\fP< _Ch_type >::regex_traits ()\fC [inline]\fP" .PP Constructs a default traits object\&. .SH "Member Function Documentation" .PP .SS "template \fBlocale_type\fP \fBstd::regex_traits\fP< _Ch_type >::getloc () const\fC [inline]\fP" .PP Gets a copy of the current locale in use by the regex_traits object\&. .SS "template \fBlocale_type\fP \fBstd::regex_traits\fP< _Ch_type >::imbue (\fBlocale_type\fP __loc)\fC [inline]\fP" .PP Imbues the regex_traits object with a copy of a new locale\&. .PP \fBParameters\fP .RS 4 \fI__loc\fP A locale\&. .RE .PP \fBReturns\fP .RS 4 a copy of the previous locale in use by the regex_traits object\&. .RE .PP \fBNote\fP .RS 4 Calling imbue with a different locale than the one currently in use invalidates all cached data held by *this\&. .RE .PP .SS "template bool \fBstd::regex_traits\fP< _Ch_type >::isctype (_Ch_type __c, char_class_type __f) const" .PP Determines if \fCc\fP is a member of an identified class\&. .PP \fBParameters\fP .RS 4 \fI__c\fP a character\&. .br \fI__f\fP a class type (as returned from lookup_classname)\&. .RE .PP \fBReturns\fP .RS 4 true if the character \fC__c\fP is a member of the classification represented by \fC__f\fP, false otherwise\&. .RE .PP \fBExceptions\fP .RS 4 \fIstd::bad_cast\fP if the current locale does not have a ctype facet\&. .RE .PP .SS "template static std::size_t \fBstd::regex_traits\fP< _Ch_type >::length (const char_type * __p)\fC [inline]\fP, \fC [static]\fP" .PP Gives the length of a C-style string starting at \fC__p\fP\&. .PP \fBParameters\fP .RS 4 \fI__p\fP a pointer to the start of a character sequence\&. .RE .PP \fBReturns\fP .RS 4 the number of characters between \fC*__p\fP and the first default-initialized value of type \fCchar_type\fP\&. In other words, uses the C-string algorithm for determining the length of a sequence of characters\&. .RE .PP .SS "template template char_class_type \fBstd::regex_traits\fP< _Ch_type >::lookup_classname (_Fwd_iter __first, _Fwd_iter __last, bool __icase = \fCfalse\fP) const" .PP Maps one or more characters to a named character classification\&. .PP \fBParameters\fP .RS 4 \fI__first\fP beginning of the character sequence\&. .br \fI__last\fP one-past-the-end of the character sequence\&. .br \fI__icase\fP ignores the case of the classification name\&. .RE .PP \fBReturns\fP .RS 4 an unspecified value that represents the character classification named by the character sequence designated by the iterator range [__first, __last)\&. If \fCicase\fP is true, the returned mask identifies the classification regardless of the case of the characters to be matched (for example, [[:lower:]] is the same as [[:alpha:]]), otherwise a case-dependent classification is returned\&. The value returned shall be independent of the case of the characters in the character sequence\&. If the name is not recognized then returns a value that compares equal to 0\&. .RE .PP At least the following names (or their wide-character equivalent) are supported\&. .IP "\(bu" 2 d .IP "\(bu" 2 w .IP "\(bu" 2 s .IP "\(bu" 2 alnum .IP "\(bu" 2 alpha .IP "\(bu" 2 blank .IP "\(bu" 2 cntrl .IP "\(bu" 2 digit .IP "\(bu" 2 graph .IP "\(bu" 2 lower .IP "\(bu" 2 print .IP "\(bu" 2 punct .IP "\(bu" 2 space .IP "\(bu" 2 upper .IP "\(bu" 2 xdigit .PP .SS "template template \fBstring_type\fP \fBstd::regex_traits\fP< _Ch_type >::lookup_collatename (_Fwd_iter __first, _Fwd_iter __last) const" .PP Gets a collation element by name\&. .PP \fBParameters\fP .RS 4 \fI__first\fP beginning of the collation element name\&. .br \fI__last\fP one-past-the-end of the collation element name\&. .RE .PP \fBReturns\fP .RS 4 a sequence of one or more characters that represents the collating element consisting of the character sequence designated by the iterator range [__first, __last)\&. Returns an empty string if the character sequence is not a valid collating element\&. .RE .PP .SS "template template \fBstring_type\fP \fBstd::regex_traits\fP< _Ch_type >::transform (_Fwd_iter __first, _Fwd_iter __last) const\fC [inline]\fP" .PP Gets a sort key for a character sequence\&. .PP \fBParameters\fP .RS 4 \fI__first\fP beginning of the character sequence\&. .br \fI__last\fP one-past-the-end of the character sequence\&. .RE .PP Returns a sort key for the character sequence designated by the iterator range [F1, F2) such that if the character sequence [G1, G2) sorts before the character sequence [H1, H2) then v\&.transform(G1, G2) < v\&.transform(H1, H2)\&. .PP What this really does is provide a more efficient way to compare a string to multiple other strings in locales with fancy collation rules and equivalence classes\&. .PP \fBReturns\fP .RS 4 a locale-specific sort key equivalent to the input range\&. .RE .PP \fBExceptions\fP .RS 4 \fIstd::bad_cast\fP if the current locale does not have a collate facet\&. .RE .PP .PP References \fBstd::basic_string< _CharT, _Traits, _Alloc >::data()\fP, and \fBstd::basic_string< _CharT, _Traits, _Alloc >::size()\fP\&. .PP Referenced by \fBstd::regex_traits< _Ch_type >::transform_primary()\fP\&. .SS "template template \fBstring_type\fP \fBstd::regex_traits\fP< _Ch_type >::transform_primary (_Fwd_iter __first, _Fwd_iter __last) const\fC [inline]\fP" .PP Gets a sort key for a character sequence, independent of case\&. .PP \fBParameters\fP .RS 4 \fI__first\fP beginning of the character sequence\&. .br \fI__last\fP one-past-the-end of the character sequence\&. .RE .PP Effects: if typeid(use_facet >) == typeid(collate_byname<_Ch_type>) and the form of the sort key returned by collate_byname<_Ch_type>::transform(__first, __last) is known and can be converted into a primary sort key then returns that key, otherwise returns an empty string\&. .PP \fBTodo\fP .RS 4 Implement this function correctly\&. .RE .PP .PP References \fBstd::vector< _Tp, _Alloc >::data()\fP, \fBstd::vector< _Tp, _Alloc >::size()\fP, and \fBstd::regex_traits< _Ch_type >::transform()\fP\&. .SS "template char_type \fBstd::regex_traits\fP< _Ch_type >::translate (char_type __c) const\fC [inline]\fP" .PP Performs the identity translation\&. .PP \fBParameters\fP .RS 4 \fI__c\fP A character to the locale-specific character set\&. .RE .PP \fBReturns\fP .RS 4 __c\&. .RE .PP .SS "template char_type \fBstd::regex_traits\fP< _Ch_type >::translate_nocase (char_type __c) const\fC [inline]\fP" .PP Translates a character into a case-insensitive equivalent\&. .PP \fBParameters\fP .RS 4 \fI__c\fP A character to the locale-specific character set\&. .RE .PP \fBReturns\fP .RS 4 the locale-specific lower-case equivalent of __c\&. .RE .PP \fBExceptions\fP .RS 4 \fIstd::bad_cast\fP if the imbued locale does not support the ctype facet\&. .RE .PP .SS "template int \fBstd::regex_traits\fP< _Ch_type >::value (_Ch_type __ch, int __radix) const" .PP Converts a digit to an int\&. .PP \fBParameters\fP .RS 4 \fI__ch\fP a character representing a digit\&. .br \fI__radix\fP the radix if the numeric conversion (limited to 8, 10, or 16)\&. .RE .PP \fBReturns\fP .RS 4 the value represented by the digit __ch in base radix if the character __ch is a valid digit in base radix; otherwise returns -1\&. .RE .PP .SH "Author" .PP Generated automatically by Doxygen for libstdc++ from the source code\&.