本文整理汇总了C++中ctype::widen方法的典型用法代码示例。如果您正苦于以下问题:C++ ctype::widen方法的具体用法?C++ ctype::widen怎么用?C++ ctype::widen使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ctype
的用法示例。
在下文中一共展示了ctype::widen方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
void _STLP_CALL
_Initialize_get_digit(wchar_t* digits, wchar_t* xdigits,
const ctype<wchar_t>& ct)
{
ct.widen(narrow_digits + 0, narrow_digits + 10, digits);
ct.widen(narrow_xdigits + 0, narrow_xdigits + 10, xdigits);
}
示例2: replace
wchar_t* _STLP_CALL
__convert_float_buffer(const char* first, const char* last, wchar_t* out,
const ctype<wchar_t>& ct, wchar_t dot)
{
ct.widen(first, last, out);
replace(out, out + (last - first), ct.widen('.'), dot);
return out + (last - first);
}
示例3: str_ite
void _STLP_CALL
__convert_float_buffer(__iostring const& str, __iowstring &out,
const ctype<wchar_t>& ct, wchar_t dot, bool __check_dot) {
wchar_t __static_buf[128];
wchar_t *__beg = __static_buf;
wchar_t *__end = __static_buf + (sizeof(__static_buf) / sizeof(wchar_t));
string::const_iterator str_ite(str.begin()), str_end(str.end());
wchar_t *__cur = __beg;
//First loop, check the dot char
if (__check_dot) {
while (str_ite != str_end) {
if (*str_ite != '.') {
*__cur = ct.widen(*str_ite);
} else {
*__cur = dot;
break;
}
++__cur;
if (__cur == __end) {
out.append(__beg, __cur);
__cur = __beg;
}
++str_ite;
}
} else {
if (str_ite != str_end) {
*__cur = ct.widen(*str_ite);
}
}
if (str_ite != str_end) {
++__cur;
++str_ite;
if (__cur == __end) {
out.append(__beg, __cur);
__cur = __beg;
}
//Second loop, dot has been found, no check anymore
while (str_ite != str_end) {
*__cur = ct.widen(*str_ite);
++__cur;
if (__cur == __end) {
out.append(__beg, __cur);
__cur = __beg;
}
++str_ite;
}
}
out.append(__beg, __cur);
}
示例4: if
int
__get_base_or_zero(_InputIter& __in_ite, _InputIter& __end,
ios_base::fmtflags __flags, const ctype<_CharT>& __c_type) {
_CharT __atoms[5];
__c_type.widen(__narrow_atoms(), __narrow_atoms() + 5, __atoms);
bool __negative = false;
_CharT __c = *__in_ite;
if (__c == __atoms[1] /* __xminus_char */ ) {
__negative = true;
++__in_ite;
}
else if (__c == __atoms[0] /* __xplus_char */ )
++__in_ite;
int __base;
int __valid_zero = 0;
ios_base::fmtflags __basefield = __flags & ios_base::basefield;
switch (__basefield) {
case ios_base::oct:
__base = 8;
break;
case ios_base::dec:
__base = 10;
break;
case ios_base::hex:
__base = 16;
if (__in_ite != __end && *__in_ite == __atoms[2] /* __zero_char */ ) {
++__in_ite;
if (__in_ite != __end &&
(*__in_ite == __atoms[3] /* __x_char */ || *__in_ite == __atoms[4] /* __X_char */ ))
++__in_ite;
else
__valid_zero = 1; // That zero is valid by itself.
}
break;
default:
if (__in_ite != __end && *__in_ite == __atoms[2] /* __zero_char */ ) {
++__in_ite;
if (__in_ite != __end &&
(*__in_ite == __atoms[3] /* __x_char */ || *__in_ite == __atoms[4] /* __X_char */ )) {
++__in_ite;
__base = 16;
}
else
{
__base = 8;
__valid_zero = 1; // That zero is still valid by itself.
}
}
else
__base = 10;
break;
}
return (__base << 2) | ((int)__negative << 1) | __valid_zero;
}
示例5:
__STL_BEGIN_NAMESPACE
//----------------------------------------------------------------------
// num_get
// Helper functions for _M_do_get_integer.
void __STL_CALL
__initialize_get_digit(wchar_t* digits, wchar_t* xdigits,
const ctype<wchar_t>& ct)
{
char narrow_digits[11] = "0123456789";
char narrow_xdigits[13] = "aAbBcCdDeEfF";
ct.widen(narrow_digits + 0, narrow_digits + 10, digits);
ct.widen(narrow_xdigits + 0, narrow_xdigits + 10, xdigits);
}