.TH "std::collate< _CharT >" 3cxx "Sun Feb 7 2021" "libstdc++" \" -*- nroff -*- .ad l .nh .SH NAME std::collate< _CharT > \- Facet for localized string comparison\&. .SH SYNOPSIS .br .PP .PP Inherits \fBstd::locale::facet\fP\&. .PP Inherited by \fBstd::collate_byname< _CharT >\fP\&. .SS "Public Types" .in +1c .ti -1c .RI "typedef _CharT \fBchar_type\fP" .br .RI "Public typedefs\&. " .ti -1c .RI "typedef \fBbasic_string\fP< _CharT > \fBstring_type\fP" .br .in -1c .SS "Public Member Functions" .in +1c .ti -1c .RI "\fBcollate\fP (__c_locale __cloc, size_t __refs=0)" .br .RI "Internal constructor\&. Not for general use\&. " .ti -1c .RI "\fBcollate\fP (size_t __refs=0)" .br .RI "Constructor performs initialization\&. " .ti -1c .RI "int \fB_M_compare\fP (const _CharT *, const _CharT *) const throw ()" .br .ti -1c .RI "int \fB_M_compare\fP (const char *, const char *) const throw()" .br .ti -1c .RI "int \fB_M_compare\fP (const wchar_t *, const wchar_t *) const throw()" .br .ti -1c .RI "size_t \fB_M_transform\fP (_CharT *, const _CharT *, size_t) const throw ()" .br .ti -1c .RI "size_t \fB_M_transform\fP (char *, const char *, size_t) const throw()" .br .ti -1c .RI "size_t \fB_M_transform\fP (wchar_t *, const wchar_t *, size_t) const throw()" .br .ti -1c .RI "int \fBcompare\fP (const _CharT *__lo1, const _CharT *__hi1, const _CharT *__lo2, const _CharT *__hi2) const" .br .RI "Compare two strings\&. " .ti -1c .RI "long \fBhash\fP (const _CharT *__lo, const _CharT *__hi) const" .br .RI "Return hash of a string\&. " .ti -1c .RI "\fBstring_type\fP \fBtransform\fP (const _CharT *__lo, const _CharT *__hi) const" .br .RI "Transform string to comparable form\&. " .in -1c .SS "Static Public Attributes" .in +1c .ti -1c .RI "static \fBlocale::id\fP \fBid\fP" .br .RI "Numpunct facet id\&. " .in -1c .SS "Protected Member Functions" .in +1c .ti -1c .RI "virtual \fB~collate\fP ()" .br .RI "Destructor\&. " .ti -1c .RI "virtual int \fBdo_compare\fP (const _CharT *__lo1, const _CharT *__hi1, const _CharT *__lo2, const _CharT *__hi2) const" .br .RI "Compare two strings\&. " .ti -1c .RI "virtual long \fBdo_hash\fP (const _CharT *__lo, const _CharT *__hi) const" .br .RI "Return hash of a string\&. " .ti -1c .RI "virtual \fBstring_type\fP \fBdo_transform\fP (const _CharT *__lo, const _CharT *__hi) const" .br .RI "Transform string to comparable form\&. " .in -1c .SS "Static Protected Member Functions" .in +1c .ti -1c .RI "static __c_locale \fB_S_clone_c_locale\fP (__c_locale &__cloc) throw ()" .br .ti -1c .RI "static void \fB_S_create_c_locale\fP (__c_locale &__cloc, const char *__s, __c_locale __old=0)" .br .ti -1c .RI "static void \fB_S_destroy_c_locale\fP (__c_locale &__cloc)" .br .ti -1c .RI "static __c_locale \fB_S_get_c_locale\fP ()" .br .ti -1c .RI "static const char * \fB_S_get_c_name\fP () throw ()" .br .ti -1c .RI "static __c_locale \fB_S_lc_ctype_c_locale\fP (__c_locale __cloc, const char *__s)" .br .in -1c .SS "Protected Attributes" .in +1c .ti -1c .RI "__c_locale \fB_M_c_locale_collate\fP" .br .in -1c .SH "Detailed Description" .PP .SS "template .br class std::collate< _CharT >" Facet for localized string comparison\&. This facet encapsulates the code to compare strings in a localized manner\&. .PP The collate template uses protected virtual functions to provide the actual results\&. The public accessors forward the call to the virtual functions\&. These virtual functions are hooks for developers to implement the behavior they require from the collate facet\&. .PP Definition at line 642 of file locale_classes\&.h\&. .SH "Member Typedef Documentation" .PP .SS "template typedef _CharT \fBstd::collate\fP< _CharT >::\fBchar_type\fP" .PP Public typedefs\&. .PP Definition at line 648 of file locale_classes\&.h\&. .SH "Constructor & Destructor Documentation" .PP .SS "template \fBstd::collate\fP< _CharT >::\fBcollate\fP (size_t __refs = \fC0\fP)\fC [inline]\fP, \fC [explicit]\fP" .PP Constructor performs initialization\&. This is the constructor provided by the standard\&. .PP \fBParameters\fP .RS 4 \fI__refs\fP Passed to the base facet class\&. .RE .PP .PP Definition at line 669 of file locale_classes\&.h\&. .SS "template \fBstd::collate\fP< _CharT >::\fBcollate\fP (__c_locale __cloc, size_t __refs = \fC0\fP)\fC [inline]\fP, \fC [explicit]\fP" .PP Internal constructor\&. Not for general use\&. This is a constructor for use by the library itself to set up new locales\&. .PP \fBParameters\fP .RS 4 \fI__cloc\fP The C locale\&. .br \fI__refs\fP Passed to the base facet class\&. .RE .PP .PP Definition at line 683 of file locale_classes\&.h\&. .SS "template virtual \fBstd::collate\fP< _CharT >::~\fBcollate\fP ()\fC [inline]\fP, \fC [protected]\fP, \fC [virtual]\fP" .PP Destructor\&. .PP Definition at line 746 of file locale_classes\&.h\&. .SH "Member Function Documentation" .PP .SS "template int \fBstd::collate\fP< _CharT >::compare (const _CharT * __lo1, const _CharT * __hi1, const _CharT * __lo2, const _CharT * __hi2) const\fC [inline]\fP" .PP Compare two strings\&. This function compares two strings and returns the result by calling collate::do_compare()\&. .PP \fBParameters\fP .RS 4 \fI__lo1\fP Start of string 1\&. .br \fI__hi1\fP End of string 1\&. .br \fI__lo2\fP Start of string 2\&. .br \fI__hi2\fP End of string 2\&. .RE .PP \fBReturns\fP .RS 4 1 if string1 > string2, -1 if string1 < string2, else 0\&. .RE .PP .PP Definition at line 700 of file locale_classes\&.h\&. .SS "template int \fBstd::collate\fP< _CharT >::do_compare (const _CharT * __lo1, const _CharT * __hi1, const _CharT * __lo2, const _CharT * __hi2) const\fC [protected]\fP, \fC [virtual]\fP" .PP Compare two strings\&. This function is a hook for derived classes to change the value returned\&. .PP \fBSee also\fP .RS 4 compare()\&. .RE .PP \fBParameters\fP .RS 4 \fI__lo1\fP Start of string 1\&. .br \fI__hi1\fP End of string 1\&. .br \fI__lo2\fP Start of string 2\&. .br \fI__hi2\fP End of string 2\&. .RE .PP \fBReturns\fP .RS 4 1 if string1 > string2, -1 if string1 < string2, else 0\&. .RE .PP .PP Definition at line 160 of file locale_classes\&.tcc\&. .PP References std::basic_string< _CharT, _Traits, _Alloc >::c_str(), std::basic_string< _CharT, _Traits, _Alloc >::data(), and std::basic_string< _CharT, _Traits, _Alloc >::length()\&. .SS "template long \fBstd::collate\fP< _CharT >::do_hash (const _CharT * __lo, const _CharT * __hi) const\fC [protected]\fP, \fC [virtual]\fP" .PP Return hash of a string\&. This function computes and returns a hash on the input string\&. This function is a hook for derived classes to change the value returned\&. .PP \fBParameters\fP .RS 4 \fI__lo\fP Start of string\&. .br \fI__hi\fP End of string\&. .RE .PP \fBReturns\fP .RS 4 Hash value\&. .RE .PP .PP Definition at line 255 of file locale_classes\&.tcc\&. .SS "template \fBcollate\fP< _CharT >::\fBstring_type\fP \fBstd::collate\fP< _CharT >::do_transform (const _CharT * __lo, const _CharT * __hi) const\fC [protected]\fP, \fC [virtual]\fP" .PP Transform string to comparable form\&. This function is a hook for derived classes to change the value returned\&. .PP \fBParameters\fP .RS 4 \fI__lo\fP Start\&. .br \fI__hi\fP End\&. .RE .PP \fBReturns\fP .RS 4 transformed string\&. .RE .PP .PP Definition at line 199 of file locale_classes\&.tcc\&. .PP References std::basic_string< _CharT, _Traits, _Alloc >::c_str(), std::basic_string< _CharT, _Traits, _Alloc >::data(), and std::basic_string< _CharT, _Traits, _Alloc >::length()\&. .SS "template long \fBstd::collate\fP< _CharT >::\fBhash\fP (const _CharT * __lo, const _CharT * __hi) const\fC [inline]\fP" .PP Return hash of a string\&. This function computes and returns a hash on the input string\&. It does so by returning collate::do_hash()\&. .PP \fBParameters\fP .RS 4 \fI__lo\fP Start of string\&. .br \fI__hi\fP End of string\&. .RE .PP \fBReturns\fP .RS 4 Hash value\&. .RE .PP .PP Definition at line 733 of file locale_classes\&.h\&. .SS "template \fBstring_type\fP \fBstd::collate\fP< _CharT >::transform (const _CharT * __lo, const _CharT * __hi) const\fC [inline]\fP" .PP Transform string to comparable form\&. This function is a wrapper for strxfrm functionality\&. It takes the input string and returns a modified string that can be directly compared to other transformed strings\&. In the C locale, this function just returns a copy of the input string\&. In some other locales, it may replace two chars with one, change a char for another, etc\&. It does so by returning collate::do_transform()\&. .PP \fBParameters\fP .RS 4 \fI__lo\fP Start of string\&. .br \fI__hi\fP End of string\&. .RE .PP \fBReturns\fP .RS 4 Transformed string_type\&. .RE .PP .PP Definition at line 719 of file locale_classes\&.h\&. .SH "Member Data Documentation" .PP .SS "template \fBlocale::id\fP \fBstd::collate\fP< _CharT >::id\fC [static]\fP" .PP Numpunct facet id\&. .PP Definition at line 659 of file locale_classes\&.h\&. .SH "Author" .PP Generated automatically by Doxygen for libstdc++ from the source code\&.