• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ locale类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中locale的典型用法代码示例。如果您正苦于以下问题:C++ locale类的具体用法?C++ locale怎么用?C++ locale使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了locale类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1:

locale basic_ios<_CharT, _Traits>::imbue(const locale& __loc)
{
    locale __tmp = ios_base::imbue(__loc);

    if (_M_streambuf)
        _M_streambuf->pubimbue(__loc);

    // no throwing here
    this->_M_cached_ctype = __loc._M_get_facet(ctype<char_type>::id) ;
    this->_M_cached_numpunct = __loc._M_get_facet(numpunct<char_type>::id) ;
    this->_M_cached_grouping = ((numpunct<char_type>*)_M_cached_numpunct)->grouping() ;
    return __tmp;
}
开发者ID:yamamushi,项目名称:services,代码行数:13,代码来源:_ios.c


示例2: old

locale _STLP_CALL locale::global(const locale& L) {
  locale old(_Stl_get_global_locale()->_M_impl);
  if (_Stl_get_global_locale()->_M_impl != L._M_impl) {
    _release_Locale_impl(_Stl_get_global_locale()->_M_impl);
    // this assign should be atomic, should be fixed here:
    _Stl_get_global_locale()->_M_impl = _get_Locale_impl(L._M_impl);

    // Set the global C locale, if appropriate.
#if !defined(_STLP_NO_LOCALE_SUPPORT) && !defined(_STLP_WINCE) && !defined(_STLP_WCE_NET)
    if (L.name() != _Nameless)
      setlocale(LC_ALL, L.name().c_str());
#endif
  }

  return old;
}
开发者ID:BackupTheBerlios,项目名称:wl530g-svn,代码行数:16,代码来源:locale.cpp


示例3: print_locale_names

void print_locale_names(const locale& my_loc)
{
	cout << "name of current global loale: " << locale().name() << '\n';
	cout << "name of classic C locale: " << locale::classic().name() << '\n';
	cout << "name of \"user's preferred locale\": " << locale("").name() << '\n';
	cout << "name of my locale: " << my_loc.name() << '\n';
}
开发者ID:sasaki-seiji,项目名称:ProgrammingLanguageCPP4th,代码行数:7,代码来源:change_global_locale.cpp


示例4:

locale basic_ios<_CharT, _Traits>::imbue(const locale& __loc) {
  locale __tmp = ios_base::imbue(__loc);
  _STLP_TRY {
    if (_M_streambuf)
      _M_streambuf->pubimbue(__loc);

    // no throwing here
    this->_M_cached_ctype = __loc._M_get_facet(ctype<char_type>::id);
    this->_M_cached_numpunct = __loc._M_get_facet(numpunct<char_type>::id);
    this->_M_cached_grouping = ((numpunct<char_type>*)_M_cached_numpunct)->grouping();
  }
  _STLP_CATCH_ALL {
    __tmp = ios_base::imbue(__tmp);
    _M_handle_exception(ios_base::failbit);
  }
  return __tmp;
}
开发者ID:RenEvo,项目名称:dead6,代码行数:17,代码来源:_ios.c


示例5: test_numpunct

void test_numpunct(const locale& loc)
{
	cout << "-- " << loc.name() << " --\n";
	cout.imbue(loc);
	cout << 123456789 << endl;
	cout << defaultfloat << 12345678.9 << endl;
	cout << fixed << 12345678.9 << endl;
	cout << boolalpha << "true: " << true << ", false: " << false << endl;
}
开发者ID:sasaki-seiji,项目名称:ProgrammingLanguageCPP4th,代码行数:9,代码来源:numpunct.cpp


示例6: lock

locale  _STLP_CALL
locale::global(const locale& L) 
{
  locale old;                   // A copy of the old global locale.

  L._M_impl->incr();
  {
    _STLP_auto_lock lock(_Stl_loc_global_locale_lock);
    _Stl_loc_global_impl->decr();     // We made a copy, so it can't be zero.
    _Stl_loc_global_impl = L._M_impl;
  }

                                // Set the global C locale, if appropriate.
#if !defined(_STLP_WINCE)
  if (L.name() != _Nameless)
    setlocale(LC_ALL, L.name().c_str());
#endif

  return old;
}
开发者ID:RaymondLiao,项目名称:elektronika,代码行数:20,代码来源:locale_impl.cpp


示例7: old

_Locale_impl* _STLP_CALL locale::global(const locale& L) {
#endif
  locale old(_Stl_get_global_locale()->_M_impl);
  if (_Stl_get_global_locale()->_M_impl != L._M_impl) {
    _release_Locale_impl(_Stl_get_global_locale()->_M_impl);
    // this assign should be atomic, should be fixed here:
    _Stl_get_global_locale()->_M_impl = _get_Locale_impl(L._M_impl);

    // Set the global C locale, if appropriate.
#if !defined(_STLP_NO_LOCALE_SUPPORT)
    if (L.name() != _Nameless)
      setlocale(LC_ALL, L.name().c_str());
#endif
  }

#if !defined (_STLP_USE_MSVC6_MEM_T_BUG_WORKAROUND)
  return old;
#else
  return old._M_impl;
#endif
}
开发者ID:ChunHungLiu,项目名称:stlport,代码行数:21,代码来源:locale.cpp


示例8:

// Compare two locales for equality.
bool locale::operator==(const locale& L) const {
  return this->_M_impl == L._M_impl ||
         (this->name() == L.name() && this->name() != _Nameless);
}
开发者ID:ChunHungLiu,项目名称:stlport,代码行数:5,代码来源:locale.cpp


示例9: nameless

// Contruct a new locale where all facets that aren't in category c
// come from L1, and all those that are in category c come from L2.
                _STLP_EXP_DECLSPEC locale::locale(const locale& L1, const locale& L2, category c)
                    : _M_impl(0)
                {
                    _Locale* impl = new _Locale(*L1._M_impl);

                    _Locale_impl* i2 = L2._M_impl;

#if defined(__LIBSTD_CPP_SYMBIAN32_WSD__) || defined(_STLP_LIBSTD_CPP_NO_STATIC_VAR_)
const string nameless("*");
# else
static string nameless("*");
# endif

                    if (L1.name() != nameless && L2.name() != nameless)
                        _Stl_loc_combine_names(impl,
                                               L1._M_impl->name.c_str(), L2._M_impl->name.c_str(),
                                               c);
                    else {
                        impl->name = "*";
                    }

                    if (c & collate) {
#if defined(__LIBSTD_CPP_SYMBIAN32_WSD__) || defined(_STLP_LIBSTD_CPP_NO_STATIC_VAR_)
impl->insert( i2, _STLP_STD::collate<char>::GetFacetLocaleId());
#else
impl->insert( i2, _STLP_STD::collate<char>::id);
#endif
# ifndef _STLP_NO_WCHAR_T
#if defined(__LIBSTD_CPP_SYMBIAN32_WSD__) || defined(_STLP_LIBSTD_CPP_NO_STATIC_VAR_)
impl->insert( i2, _STLP_STD::collate<wchar_t>::GetFacetLocaleId());
#else
impl->insert( i2, _STLP_STD::collate<wchar_t>::id);
#endif //__LIBSTD_CPP_SYMBIAN32_WSD__    
# endif //!_STLP_NO_WCHAR_T
}
if (c & ctype) {
#if defined(__LIBSTD_CPP_SYMBIAN32_WSD__) || defined(_STLP_LIBSTD_CPP_NO_STATIC_VAR_)
impl->insert( i2, _STLP_STD::codecvt<char, char, mbstate_t>::GetFacetLocaleId());
impl->insert( i2, _STLP_STD::ctype<char>::GetFacetLocaleId());
#else
impl->insert( i2, _STLP_STD::codecvt<char, char, mbstate_t>::id);
impl->insert( i2, _STLP_STD::ctype<char>::id);
#endif //__LIBSTD_CPP_SYMBIAN32_WSD__

# ifndef _STLP_NO_WCHAR_T
#if defined(__LIBSTD_CPP_SYMBIAN32_WSD__) || defined(_STLP_LIBSTD_CPP_NO_STATIC_VAR_)
impl->insert( i2, _STLP_STD::ctype<wchar_t>::GetFacetLocaleId());
impl->insert( i2, _STLP_STD::codecvt<wchar_t, char, mbstate_t>::GetFacetLocaleId());
#else
impl->insert( i2, _STLP_STD::ctype<wchar_t>::id);
impl->insert( i2, _STLP_STD::codecvt<wchar_t, char, mbstate_t>::id);
#endif //__LIBSTD_CPP_SYMBIAN32_WSD__   
# endif //!_STLP_NO_WCHAR_T
}
if (c & monetary) {
#if defined(__LIBSTD_CPP_SYMBIAN32_WSD__) || defined(_STLP_LIBSTD_CPP_NO_STATIC_VAR_)
impl->insert( i2, _STLP_STD::moneypunct<char, true>::GetFacetLocaleId());
impl->insert( i2, _STLP_STD::moneypunct<char, false>::GetFacetLocaleId());
impl->insert( i2, _STLP_STD::money_get<char, istreambuf_iterator<char, char_traits<char> > >::GetFacetLocaleId());
impl->insert( i2, _STLP_STD::money_put<char, ostreambuf_iterator<char, char_traits<char> > >::GetFacetLocaleId());
#else
impl->insert( i2, _STLP_STD::moneypunct<char, true>::id);
impl->insert( i2, _STLP_STD::moneypunct<char, false>::id);
impl->insert( i2, _STLP_STD::money_get<char, istreambuf_iterator<char, char_traits<char> > >::id);
impl->insert( i2, _STLP_STD::money_put<char, ostreambuf_iterator<char, char_traits<char> > >::id);
#endif //__LIBSTD_CPP_SYMBIAN32_WSD__       

# ifndef _STLP_NO_WCHAR_T
#if defined(__LIBSTD_CPP_SYMBIAN32_WSD__) || defined(_STLP_LIBSTD_CPP_NO_STATIC_VAR_)
impl->insert( i2, _STLP_STD::moneypunct<wchar_t, true>::GetFacetLocaleId());
impl->insert( i2, _STLP_STD::moneypunct<wchar_t, false>::GetFacetLocaleId());
impl->insert( i2, _STLP_STD::money_get<wchar_t, istreambuf_iterator<wchar_t, char_traits<wchar_t> > >::GetFacetLocaleId());
impl->insert( i2, _STLP_STD::money_put<wchar_t, ostreambuf_iterator<wchar_t, char_traits<wchar_t> > >::GetFacetLocaleId());
#else
impl->insert( i2, _STLP_STD::moneypunct<wchar_t, true>::id);
impl->insert( i2, _STLP_STD::moneypunct<wchar_t, false>::id);
impl->insert( i2, _STLP_STD::money_get<wchar_t, istreambuf_iterator<wchar_t, char_traits<wchar_t> > >::id);
impl->insert( i2, _STLP_STD::money_put<wchar_t, ostreambuf_iterator<wchar_t, char_traits<wchar_t> > >::id);
#endif  //__LIBSTD_CPP_SYMBIAN32_WSD__         
# endif //!_STLP_NO_WCHAR_T
}
if (c & numeric) {
#if defined(__LIBSTD_CPP_SYMBIAN32_WSD__) || defined(_STLP_LIBSTD_CPP_NO_STATIC_VAR_)
impl->insert( i2, _STLP_STD::numpunct<char>::GetFacetLocaleId());
impl->insert( i2, _STLP_STD::num_get<char, istreambuf_iterator<char, char_traits<char> > >::GetFacetLocaleId());
impl->insert( i2, _STLP_STD::num_put<char, ostreambuf_iterator<char, char_traits<char> > >::GetFacetLocaleId());
#else
impl->insert( i2, _STLP_STD::numpunct<char>::id);
impl->insert( i2, _STLP_STD::num_get<char, istreambuf_iterator<char, char_traits<char> > >::id);
impl->insert( i2, _STLP_STD::num_put<char, ostreambuf_iterator<char, char_traits<char> > >::id);
#endif

# ifndef _STLP_NO_WCHAR_T
#if defined(__LIBSTD_CPP_SYMBIAN32_WSD__) || defined(_STLP_LIBSTD_CPP_NO_STATIC_VAR_)
impl->insert(i2, _STLP_STD::numpunct<wchar_t>::GetFacetLocaleId());
impl->insert( i2, num_get<wchar_t, istreambuf_iterator<wchar_t, char_traits<wchar_t> > >::GetFacetLocaleId());
impl->insert( i2, num_put<wchar_t, ostreambuf_iterator<wchar_t, char_traits<wchar_t> > >::GetFacetLocaleId());
#else
//.........这里部分代码省略.........
开发者ID:kuailexs,项目名称:symbiandump-os2,代码行数:101,代码来源:locale_catalog.cpp



注:本文中的locale类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ locationt类代码示例发布时间:2022-05-31
下一篇:
C++ local_date_time类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap