此类说明的区域设置对象的封装作为一组共同定义特定的本地化的环境方面的特定于区域性的信息。
class locale {
public:
class facet;
class id;
typedef int category;
static const category none, collate, ctype, monetary,
numeric, time, messages, all;
locale();
explicit locale(
const char *_Locname
);
explicit locale(
const string& _Locname
);
locale(
const locale& _Loc,
const locale& _Other,
category cat
);
locale(
const locale& _Loc,
const char *_Locname,
category cat
);
locale(
const locale& _Loc,
const string& _Locname,
category _Cat
);
template<class Facet>
locale(
const locale& _Loc,
Facet *_Fac
);
template<class Facet>
locale combine(
const locale& _Loc
) const;
template<class Elem, class Tr, class Alloc>
bool operator()(
const basic_string<Elem, Tr, Alloc>& _Left,
const basic_string<Elem, Tr, Alloc>& _Right
) const;
string name() const;
bool operator== (
const locale& _Right
) const;
bool operator!=(
const locale& _Right
) const;
static locale global(
const locale& _Right
);
static const locale& classic();
};
备注
方面是从类派生的类的对象的指针小平面的具有该窗体的公用对象:
static locale::id id;
您可以定义开放端的组,这些方面。您还可以构造一个区域设置对象,它将指定任意数量的小平面。
这些方面的预定义的组代表区域设置类别在标准 C 库函数传统上托管setlocale。
类别逐份打印 (LC_COLLATE) 包括的方面:
collate<char>
collate<wchar_t>
类别 ctype (LC_CTYPE) 包括的方面:
ctype<char>
ctype<wchar_t>
codecvt<char, char, mbstate_t>
codecvt<wchar_t, char, mbstate_t>
codecvt<char16_t, char, mbstate_t>
codecvt<char32_t, char, mbstate_t>
类别货币 (LC_MONETARY) 中包括的方面:
moneypunct<char, false>
moneypunct<wchar_t, false>
moneypunct<char, true>
moneypunct<wchar_t, true>
money_get<char, istreambuf_iterator<char> >
money_get<wchar_t, istreambuf_iterator<wchar_t> >
money_put<char, ostreambuf_iterator<char> >
money_put<wchar_t, ostreambuf_iterator<wchar_t> >
类别数字 (LC_NUMERIC) 包括的方面:
num_get<char, istreambuf_iterator<char> >
num_get<wchar_t, istreambuf_iterator<wchar_t> >
num_put<char, ostreambuf_iterator<char> >
num_put<wchar_t, ostreambuf_iterator<wchar_t> >
numpunct<char>
numpunct<wchar_t>
类别的时间 (LC_TIME) 包括的方面:
time_get<char, istreambuf_iterator<char> >
time_get<wchar_t, istreambuf_iterator<wchar_t> >
time_put<char, ostreambuf_iterator<char> >
time_put<wchar_t, ostreambuf_iterator<wchar_t> >
类别的消息 (LC_MESSAGES) 包括的方面:
messages<char>
messages<wchar_t>
(最后一个分类要求通过 Posix,但没有 C 标准)。
Iostreams 类中,使用这些预定义方面的一些控制文本序列之间的数值转换。
类区域设置的对象也将作为类的对象存储区域设置名称字符串。使用了无效的区域设置名称的区域设置方面或区域设置对象构造将类的对象引发 runtime_error。存储区域设置名称是"*"如果区域设置对象不能为某些 C 样式的区域设置相对应正好为对象所表示的。否则,您可以建立在标准 C 库中,区域设置对象匹配的区域设置_Loc,通过调用setlocale(LC_ALL, _Loc。名称().c_str()).
在此实现中,您还可以调用的静态成员函数:
static locale empty( );
构造区域设置对象具有的任何方面。它也是透明的区域设置。 如果模板函数 has_facet 和 use_facet 找不到请求的小平面中透明的区域设置中,他们查阅第一次全局区域设置,然后,如果是透明的传统的区域设置。因此,您可以编写:
cout.imbue(locale::empty( ));
随后执行的插入 cout 人们通过全局区域设置的当前状态。您甚至可以编写:
locale loc(locale::empty( ), locale::classic( ),
locale::numeric);
cout.imbue(loc);
数字格式设置规则以进行后续插入到cout中保持不变以 C 语言环境,即使在全局区域设置提供不断变化的规则,用于插入日期和货币金额。
构造函数
创建一个区域设置,或一份区域设置或其中某个方面类别已更换或由小平面或类别,从另一个区域设置的区域设置的副本。 |
Typedef
提供表示标准方面家族的位掩码值的整数类型。 |
成员函数
将某个方面插入到目标区域设置指定的区域设置。 |
|
返回存储的区域设置名称。 |
静态函数
静态成员函数返回表示传统的 C 语言的区域设置对象。 |
|
重置为默认的本地的程序。 |
运算符
测试不相等的两个区域设置。 |
|
比较两个 basic_string 对象。 |
|
测试相等的两个区域设置。 |
类
用作所有区域设置方面的基类的类。 |
|
成员的类提供的索引用于查找小平面区域设置中使用方面的唯一标识。 |
要求
标题: <locale>
命名空间: 标准