.TH "std::locale" 3cxx "Thu Aug 2 2012" "libstdc++" \" -*- nroff -*- .ad l .nh .SH NAME std::locale \- .SH SYNOPSIS .br .PP .SS "Classes" .in +1c .ti -1c .RI "class \fBfacet\fP" .br .RI "\fILocalization functionality base class\&. \fP" .ti -1c .RI "class \fBid\fP" .br .RI "\fIFacet ID class\&. \fP" .in -1c .SS "Public Types" .in +1c .ti -1c .RI "typedef int \fBcategory\fP" .br .in -1c .SS "Public Member Functions" .in +1c .ti -1c .RI "template \fBlocale\fP \fBcombine\fP (const \fBlocale\fP &__other) const " .br .ti -1c .RI "\fBlocale\fP () throw ()" .br .ti -1c .RI "\fBlocale\fP (const \fBlocale\fP &__other) throw ()" .br .ti -1c .RI "\fBlocale\fP (const char *__s)" .br .ti -1c .RI "\fBlocale\fP (const \fBlocale\fP &__base, const char *__s, \fBcategory\fP __cat)" .br .ti -1c .RI "\fBlocale\fP (const \fBlocale\fP &__base, const \fBlocale\fP &__add, \fBcategory\fP __cat)" .br .ti -1c .RI "template \fBlocale\fP (const \fBlocale\fP &__other, _Facet *__f)" .br .ti -1c .RI "\fBstring\fP \fBname\fP () const " .br .ti -1c .RI "bool \fBoperator!=\fP (const \fBlocale\fP &__other) const throw ()" .br .ti -1c .RI "template bool \fBoperator()\fP (const \fBbasic_string\fP< _CharT, _Traits, _Alloc > &__s1, const \fBbasic_string\fP< _CharT, _Traits, _Alloc > &__s2) const " .br .ti -1c .RI "template bool \fBoperator()\fP (const \fBbasic_string\fP< _Char, _Traits, _Alloc > &__s1, const \fBbasic_string\fP< _Char, _Traits, _Alloc > &__s2) const " .br .ti -1c .RI "const \fBlocale\fP & \fBoperator=\fP (const \fBlocale\fP &__other) throw ()" .br .ti -1c .RI "bool \fBoperator==\fP (const \fBlocale\fP &__other) const throw ()" .br .ti -1c .RI "\fB~locale\fP () throw ()" .br .in -1c .SS "Static Public Member Functions" .in +1c .ti -1c .RI "static const \fBlocale\fP & \fBclassic\fP ()" .br .ti -1c .RI "static \fBlocale\fP \fBglobal\fP (const \fBlocale\fP &)" .br .in -1c .SS "Static Public Attributes" .PP .RI "\fB\fP" .br .in +1c .in +1c .ti -1c .RI "static const \fBcategory\fP \fBnone\fP" .br .ti -1c .RI "static const \fBcategory\fP \fBctype\fP" .br .ti -1c .RI "static const \fBcategory\fP \fBnumeric\fP" .br .ti -1c .RI "static const \fBcategory\fP \fBcollate\fP" .br .ti -1c .RI "static const \fBcategory\fP \fBtime\fP" .br .ti -1c .RI "static const \fBcategory\fP \fBmonetary\fP" .br .ti -1c .RI "static const \fBcategory\fP \fBmessages\fP" .br .ti -1c .RI "static const \fBcategory\fP \fBall\fP" .br .in -1c .in -1c .SS "Friends" .in +1c .ti -1c .RI "struct \fB__use_cache\fP" .br .ti -1c .RI "class \fB_Impl\fP" .br .ti -1c .RI "class \fBfacet\fP" .br .ti -1c .RI "template bool \fBhas_facet\fP (const \fBlocale\fP &) throw ()" .br .ti -1c .RI "template const _Facet & \fBuse_facet\fP (const \fBlocale\fP &)" .br .in -1c .SH "Detailed Description" .PP Container class for localization functionality\&. The locale class is first a class wrapper for C library locales\&. It is also an extensible container for user-defined localization\&. A locale is a collection of facets that implement various localization features such as money, time, and number printing\&. .PP Constructing C++ locales does not change the C library locale\&. .PP This library supports efficient construction and copying of locales through a reference counting implementation of the locale class\&. .PP Definition at line 61 of file locale_classes\&.h\&. .SH "Member Typedef Documentation" .PP .SS "typedef int \fBstd::locale::category\fP" .PP Definition of \fBlocale::category\fP\&. .PP Definition at line 66 of file locale_classes\&.h\&. .SH "Constructor & Destructor Documentation" .PP .SS "std::locale::locale () throw ()" .PP Default constructor\&. Constructs a copy of the global locale\&. If no locale has been explicitly set, this is the 'C' locale\&. .SS "std::locale::locale (const \fBlocale\fP &__other) throw ()" .PP Copy constructor\&. Constructs a copy of \fIother\fP\&. .PP \fBParameters:\fP .RS 4 \fIother\fP The locale to copy\&. .RE .PP .SS "std::locale::locale (const char *__s)\fC [explicit]\fP" .PP Named locale constructor\&. Constructs a copy of the named C library locale\&. .PP \fBParameters:\fP .RS 4 \fIs\fP Name of the locale to construct\&. .RE .PP \fBExceptions:\fP .RS 4 \fI\fBstd::runtime_error\fP\fP if s is null or an undefined locale\&. .RE .PP .SS "std::locale::locale (const \fBlocale\fP &__base, const char *__s, \fBcategory\fP__cat)" .PP Construct locale with facets from another locale\&. Constructs a copy of the locale \fIbase\fP\&. The facets specified by \fIcat\fP are replaced with those from the locale named by \fIs\fP\&. If base is named, this locale instance will also be named\&. .PP \fBParameters:\fP .RS 4 \fIbase\fP The locale to copy\&. .br \fIs\fP Name of the locale to use facets from\&. .br \fIcat\fP Set of categories defining the facets to use from s\&. .RE .PP \fBExceptions:\fP .RS 4 \fI\fBstd::runtime_error\fP\fP if s is null or an undefined locale\&. .RE .PP .SS "std::locale::locale (const \fBlocale\fP &__base, const \fBlocale\fP &__add, \fBcategory\fP__cat)" .PP Construct locale with facets from another locale\&. Constructs a copy of the locale \fIbase\fP\&. The facets specified by \fIcat\fP are replaced with those from the locale \fIadd\fP\&. If \fIbase\fP and \fIadd\fP are named, this locale instance will also be named\&. .PP \fBParameters:\fP .RS 4 \fIbase\fP The locale to copy\&. .br \fIadd\fP The locale to use facets from\&. .br \fIcat\fP Set of categories defining the facets to use from add\&. .RE .PP .SS "template std::locale::locale (const \fBlocale\fP &__other, _Facet *__f)" .PP Construct locale with another facet\&. Constructs a copy of the locale \fIother\fP\&. The facet is added to , replacing an existing facet of type Facet if there is one\&. If is null, this locale is a copy of \fIother\fP\&. .PP \fBParameters:\fP .RS 4 \fIother\fP The locale to copy\&. .br \fIf\fP The facet to add in\&. .RE .PP .PP Definition at line 43 of file locale_classes\&.tcc\&. .SS "std::locale::~locale () throw ()" .PP Locale destructor\&. .SH "Member Function Documentation" .PP .SS "static const \fBlocale\fP& std::locale::classic ()\fC [static]\fP" .PP Return reference to the 'C' locale\&. .SS "template \fBlocale\fP std::locale::combine (const \fBlocale\fP &__other) const" .PP Construct locale with another facet\&. Constructs and returns a new copy of this locale\&. Adds or replaces an existing facet of type Facet from the locale \fIother\fP into the new locale\&. .PP \fBParameters:\fP .RS 4 \fIFacet\fP The facet type to copy from other .br \fIother\fP The locale to copy from\&. .RE .PP \fBReturns:\fP .RS 4 Newly constructed locale\&. .RE .PP \fBExceptions:\fP .RS 4 \fI\fBstd::runtime_error\fP\fP if other has no facet of type Facet\&. .RE .PP .PP Definition at line 61 of file locale_classes\&.tcc\&. .SS "static \fBlocale\fP std::locale::global (const \fBlocale\fP &)\fC [static]\fP" .PP Set global locale\&. This function sets the global locale to the argument and returns a copy of the previous global locale\&. If the argument has a name, it will also call std::setlocale(LC_ALL, loc\&.name())\&. .PP \fBParameters:\fP .RS 4 \fIlocale\fP The new locale to make global\&. .RE .PP \fBReturns:\fP .RS 4 Copy of the old global locale\&. .RE .PP .SS "\fBstring\fP std::locale::name () const" .PP Return locale name\&. \fBReturns:\fP .RS 4 Locale name or '*' if unnamed\&. .RE .PP .SS "bool std::locale::operator!= (const \fBlocale\fP &__other) const throw ()\fC [inline]\fP" .PP Locale inequality\&. \fBParameters:\fP .RS 4 \fIother\fP The locale to compare against\&. .RE .PP \fBReturns:\fP .RS 4 ! (*this == other) .RE .PP .PP Definition at line 233 of file locale_classes\&.h\&. .SS "template bool std::locale::operator() (const \fBbasic_string\fP< _Char, _Traits, _Alloc > &__s1, const \fBbasic_string\fP< _Char, _Traits, _Alloc > &__s2) const" .PP Compare two strings according to collate\&. Template operator to compare two strings using the compare function of the collate facet in this locale\&. One use is to provide the locale to the sort function\&. For example, a vector v of strings could be sorted according to locale loc by doing: .PP .nf std::sort(v\&.begin(), v\&.end(), loc); .fi .PP .PP \fBParameters:\fP .RS 4 \fIs1\fP First string to compare\&. .br \fIs2\fP Second string to compare\&. .RE .PP \fBReturns:\fP .RS 4 True if collate facet compares s1 < s2, else false\&. .RE .PP .SS "const \fBlocale\fP& std::locale::operator= (const \fBlocale\fP &__other) throw ()" .PP Assignment operator\&. Set this locale to be a copy of \fIother\fP\&. .PP \fBParameters:\fP .RS 4 \fIother\fP The locale to copy\&. .RE .PP \fBReturns:\fP .RS 4 A reference to this locale\&. .RE .PP .SS "bool std::locale::operator== (const \fBlocale\fP &__other) const throw ()" .PP Locale equality\&. \fBParameters:\fP .RS 4 \fIother\fP The locale to compare against\&. .RE .PP \fBReturns:\fP .RS 4 True if other and this refer to the same locale instance, are copies, or have the same name\&. False otherwise\&. .RE .PP .SH "Friends And Related Function Documentation" .PP .SS "template bool has_facet (const \fBlocale\fP &) throw ()\fC [friend]\fP" .PP Test for the presence of a facet\&. has_facet tests the locale argument for the presence of the facet type provided as the template parameter\&. Facets derived from the facet parameter will also return true\&. .PP \fBParameters:\fP .RS 4 \fIFacet\fP The facet type to test the presence of\&. .br \fIlocale\fP The locale to test\&. .RE .PP \fBReturns:\fP .RS 4 true if locale contains a facet of type Facet, else false\&. .RE .PP .SS "template const _Facet& use_facet (const \fBlocale\fP &)\fC [friend]\fP" .PP Return a facet\&. use_facet looks for and returns a reference to a facet of type Facet where Facet is the template parameter\&. If has_facet(locale) is true, there is a suitable facet to return\&. It throws \fBstd::bad_cast\fP if the locale doesn't contain a facet of type Facet\&. .PP \fBParameters:\fP .RS 4 \fIFacet\fP The facet type to access\&. .br \fIlocale\fP The locale to use\&. .RE .PP \fBReturns:\fP .RS 4 Reference to facet of type Facet\&. .RE .PP \fBExceptions:\fP .RS 4 \fI\fBstd::bad_cast\fP\fP if locale doesn't contain a facet of type Facet\&. .RE .PP .SH "Member Data Documentation" .PP .SS "const \fBcategory\fP std::locale::all\fC [static]\fP" .PP Category values\&. The standard category values are none, ctype, numeric, collate, time, monetary, and messages\&. They form a bitmask that supports union and intersection\&. The category all is the union of these values\&. .PP NB: Order must match _S_facet_categories definition in locale\&.cc .PP Definition at line 104 of file locale_classes\&.h\&. .SS "const \fBcategory\fP std::locale::collate\fC [static]\fP" .PP Category values\&. The standard category values are none, ctype, numeric, collate, time, monetary, and messages\&. They form a bitmask that supports union and intersection\&. The category all is the union of these values\&. .PP NB: Order must match _S_facet_categories definition in locale\&.cc .PP Definition at line 100 of file locale_classes\&.h\&. .SS "const \fBcategory\fP std::locale::ctype\fC [static]\fP" .PP Category values\&. The standard category values are none, ctype, numeric, collate, time, monetary, and messages\&. They form a bitmask that supports union and intersection\&. The category all is the union of these values\&. .PP NB: Order must match _S_facet_categories definition in locale\&.cc .PP Definition at line 98 of file locale_classes\&.h\&. .SS "const \fBcategory\fP std::locale::messages\fC [static]\fP" .PP Category values\&. The standard category values are none, ctype, numeric, collate, time, monetary, and messages\&. They form a bitmask that supports union and intersection\&. The category all is the union of these values\&. .PP NB: Order must match _S_facet_categories definition in locale\&.cc .PP Definition at line 103 of file locale_classes\&.h\&. .SS "const \fBcategory\fP std::locale::monetary\fC [static]\fP" .PP Category values\&. The standard category values are none, ctype, numeric, collate, time, monetary, and messages\&. They form a bitmask that supports union and intersection\&. The category all is the union of these values\&. .PP NB: Order must match _S_facet_categories definition in locale\&.cc .PP Definition at line 102 of file locale_classes\&.h\&. .SS "const \fBcategory\fP std::locale::none\fC [static]\fP" .PP Category values\&. The standard category values are none, ctype, numeric, collate, time, monetary, and messages\&. They form a bitmask that supports union and intersection\&. The category all is the union of these values\&. .PP NB: Order must match _S_facet_categories definition in locale\&.cc .PP Definition at line 97 of file locale_classes\&.h\&. .SS "const \fBcategory\fP std::locale::numeric\fC [static]\fP" .PP Category values\&. The standard category values are none, ctype, numeric, collate, time, monetary, and messages\&. They form a bitmask that supports union and intersection\&. The category all is the union of these values\&. .PP NB: Order must match _S_facet_categories definition in locale\&.cc .PP Definition at line 99 of file locale_classes\&.h\&. .SS "const \fBcategory\fP std::locale::time\fC [static]\fP" .PP Category values\&. The standard category values are none, ctype, numeric, collate, time, monetary, and messages\&. They form a bitmask that supports union and intersection\&. The category all is the union of these values\&. .PP NB: Order must match _S_facet_categories definition in locale\&.cc .PP Definition at line 101 of file locale_classes\&.h\&. .SH "Author" .PP Generated automatically by Doxygen for libstdc++ from the source code\&.