Пример #1
0
void _Locale_impl::insert_numeric_facets(const char* pname)
{
  numpunct<char>*    punct  = 0;
  num_get<char, istreambuf_iterator<char, char_traits<char> > >*     get    = 0;
  num_put<char, ostreambuf_iterator<char, char_traits<char> > >*     put    = 0;
# ifndef __STL_NO_WCHAR_T
  numpunct<wchar_t>* wpunct = 0;
  num_get<wchar_t, istreambuf_iterator<wchar_t, char_traits<wchar_t> > >*  wget   = 0;
  num_put<wchar_t, ostreambuf_iterator<wchar_t, char_traits<wchar_t> > >*  wput   = 0;
# endif

  char buf[_Locale_MAX_SIMPLE_NAME];
  if (pname == 0 || pname[0] == 0)
    pname = _Locale_numeric_default(buf);

  if (pname == 0 || pname[0] == 0 || strcmp(pname, "C") == 0) {
    this->insert(_Stl_loc_classic_locale->_M_impl, numpunct<char>::id);
    this->insert(_Stl_loc_classic_locale->_M_impl, 
		 num_put<char, ostreambuf_iterator<char, char_traits<char> >  >::id);
    this->insert(_Stl_loc_classic_locale->_M_impl, 
		 num_get<char, istreambuf_iterator<char, char_traits<char> > >::id);
# ifndef __STL_NO_WCHAR_T
    this->insert(_Stl_loc_classic_locale->_M_impl, numpunct<wchar_t>::id);
    this->insert(_Stl_loc_classic_locale->_M_impl, 
		 num_get<wchar_t, istreambuf_iterator<wchar_t, char_traits<wchar_t> >  >::id);
    this->insert(_Stl_loc_classic_locale->_M_impl, 
		 num_put<wchar_t, ostreambuf_iterator<wchar_t, char_traits<wchar_t> > >::id);
# endif
  }
  else {
    __STL_TRY {
      punct  = new numpunct_byname<char>(pname);
      get    = new num_get<char, istreambuf_iterator<char, char_traits<char> > >;
      put    = new num_put<char, ostreambuf_iterator<char, char_traits<char> > >;
# ifndef __STL_NO_WCHAR_T
      wpunct = new numpunct_byname<wchar_t>(pname);
      wget   = new num_get<wchar_t, istreambuf_iterator<wchar_t, char_traits<wchar_t> > >;
      wput   = new num_put<wchar_t, ostreambuf_iterator<wchar_t, char_traits<wchar_t> > >;
# endif
    }
# ifndef __STL_NO_WCHAR_T
    __STL_UNWIND(delete punct; delete wpunct; delete get; delete wget;
    delete put; delete wput);
# else
    __STL_UNWIND(delete punct; delete get;delete put);
# endif
    
  _Locale_impl_insert(this,punct);
  _Locale_impl_insert(this,get);
  _Locale_impl_insert(this,put);

# ifndef __STL_NO_WCHAR_T
  _Locale_impl_insert(this,wpunct);
  _Locale_impl_insert(this,wget);
  _Locale_impl_insert(this,wput);
# endif
  }
}
 const char* _Loc_numeric_default(char * p) { return _Locale_numeric_default(p); }
Пример #3
0
_Locale_name_hint* _Locale_impl::insert_numeric_facets(const char* pname, _Locale_name_hint* hint) {
  _Locale_impl* i2 = locale::classic()._M_impl;

  numpunct<char>* punct = 0;
  num_get<char, istreambuf_iterator<char, char_traits<char> > > *get = 0;
  num_put<char, ostreambuf_iterator<char, char_traits<char> > > *put = 0;
#ifndef _STLP_NO_WCHAR_T
  numpunct<wchar_t>* wpunct = 0;
  num_get<wchar_t, istreambuf_iterator<wchar_t, char_traits<wchar_t> > > *wget = 0;
  num_put<wchar_t, ostreambuf_iterator<wchar_t, char_traits<wchar_t> > > *wput = 0;
#endif

  char buf[_Locale_MAX_SIMPLE_NAME];
  if (pname == 0 || pname[0] == 0)
    pname = _Locale_numeric_default(buf);

  if (pname == 0 || pname[0] == 0 || is_C_locale_name(pname)) {
    this->insert(i2, numpunct<char>::id);
    this->insert(i2,
                 num_put<char, ostreambuf_iterator<char, char_traits<char> >  >::id);
    this->insert(i2,
                 num_get<char, istreambuf_iterator<char, char_traits<char> > >::id);
#ifndef _STLP_NO_WCHAR_T
    this->insert(i2, numpunct<wchar_t>::id);
    this->insert(i2,
                 num_get<wchar_t, istreambuf_iterator<wchar_t, char_traits<wchar_t> >  >::id);
    this->insert(i2,
                 num_put<wchar_t, ostreambuf_iterator<wchar_t, char_traits<wchar_t> > >::id);
#endif
  }
  else {
    _STLP_TRY {
      numpunct_byname<char> *punctbn = _CHECK_PTR(new numpunct_byname<char>(pname, 0, hint));
      punct  = punctbn;
#if !defined (__DMC__)
      if (hint == 0) hint = _Locale_extract_hint(punctbn);
#endif
      get    = _CHECK_PTR(new num_get<char, istreambuf_iterator<char, char_traits<char> > >);
      put    = _CHECK_PTR(new num_put<char, ostreambuf_iterator<char, char_traits<char> > >);
#ifndef _STLP_NO_WCHAR_T
      wpunct = _CHECK_PTR(new numpunct_byname<wchar_t>(pname, 0, hint));
      wget   = _CHECK_PTR(new num_get<wchar_t, istreambuf_iterator<wchar_t, char_traits<wchar_t> > >);
      wput   = _CHECK_PTR(new num_put<wchar_t, ostreambuf_iterator<wchar_t, char_traits<wchar_t> > >);
#endif
    }
#ifndef _STLP_NO_WCHAR_T
    _STLP_UNWIND(delete punct; delete wpunct; delete get; delete wget; delete put; delete wput);
#else
    _STLP_UNWIND(delete punct; delete get;delete put);
#endif

    _Locale_insert(this,punct);
    _Locale_insert(this,get);
    _Locale_insert(this,put);

#ifndef _STLP_NO_WCHAR_T
    _Locale_insert(this,wpunct);
    _Locale_insert(this,wget);
    _Locale_insert(this,wput);
#endif
  }
  return hint;
}
Пример #4
0
                                void _Locale::insert_numeric_facets(const char* pname)
                                {
                                    _Locale_impl* i2 = locale::classic()._M_impl;

                                    numpunct<char>*    punct  = 0;
                                    num_get<char, istreambuf_iterator<char, char_traits<char> > >*     get    = 0;
                                    num_put<char, ostreambuf_iterator<char, char_traits<char> > >*     put    = 0;
# ifndef _STLP_NO_WCHAR_T
numpunct<wchar_t>* wpunct = 0;
num_get<wchar_t, istreambuf_iterator<wchar_t, char_traits<wchar_t> > >*  wget   = 0;
num_put<wchar_t, ostreambuf_iterator<wchar_t, char_traits<wchar_t> > >*  wput   = 0;
# endif

                                    char buf[_Locale_MAX_SIMPLE_NAME];
                                    if (pname == 0 || pname[0] == 0)
                                        pname = _Locale_numeric_default(buf);

                                    if (pname == 0 || pname[0] == 0 || strcmp(pname, "C") == 0) {
#if defined(__LIBSTD_CPP_SYMBIAN32_WSD__) || defined(_STLP_LIBSTD_CPP_NO_STATIC_VAR_)
this->insert(i2, numpunct<char>::GetFacetLocaleId());
this->insert(i2, num_put<char, ostreambuf_iterator<char, char_traits<char> >  >::GetFacetLocaleId());
this->insert(i2, num_get<char, istreambuf_iterator<char, char_traits<char> > >::GetFacetLocaleId());
#else
this->insert(i2, numpunct<char>::id);
this->insert(i2, num_put<char, ostreambuf_iterator<char, char_traits<char> >  >::id);
this->insert(i2, num_get<char, istreambuf_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_)
this->insert(i2, numpunct<wchar_t>::GetFacetLocaleId());
this->insert(i2, num_get<wchar_t, istreambuf_iterator<wchar_t, char_traits<wchar_t> >  >::GetFacetLocaleId());
this->insert(i2, num_put<wchar_t, ostreambuf_iterator<wchar_t, char_traits<wchar_t> > >::GetFacetLocaleId());
#else
this->insert(i2, numpunct<wchar_t>::id);
this->insert(i2, num_get<wchar_t, istreambuf_iterator<wchar_t, char_traits<wchar_t> >  >::id);
this->insert(i2, num_put<wchar_t, ostreambuf_iterator<wchar_t, char_traits<wchar_t> > >::id);
#endif //__LIBSTD_CPP_SYMBIAN32_WSD__    
# endif //!_STLP_NO_WCHAR_T
} 
else {
_STLP_TRY {
punct  = new numpunct_byname<char>(pname);
get    = new num_get<char, istreambuf_iterator<char, char_traits<char> > >;
put    = new num_put<char, ostreambuf_iterator<char, char_traits<char> > >;
# ifndef _STLP_NO_WCHAR_T
wpunct = new numpunct_byname<wchar_t>(pname);
wget   = new num_get<wchar_t, istreambuf_iterator<wchar_t, char_traits<wchar_t> > >;
wput   = new num_put<wchar_t, ostreambuf_iterator<wchar_t, char_traits<wchar_t> > >;
# endif
}
# ifndef _STLP_NO_WCHAR_T
_STLP_UNWIND(delete punct; delete wpunct; delete get; delete wget;
delete put; delete wput);
# else
_STLP_UNWIND(delete punct; delete get; delete put);
# endif

                                        _Locale_insert(this,punct);
                                        _Locale_insert(this,get);
                                        _Locale_insert(this,put);

# ifndef _STLP_NO_WCHAR_T
_Locale_insert(this,wpunct);
_Locale_insert(this,wget);
_Locale_insert(this,wput);
# endif
}
}