-// Copyright (C) 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
+// Copyright (C) 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
}
locale::_Impl::
- _Impl(const _Impl& __other, size_t __refs)
+ _Impl(const _Impl& __imp, size_t __refs)
: _M_references(__refs - 1), _M_facets(0), _M_category_names(0),
- _M_has_name(__other._M_has_name), _M_name(__other._M_name)
+ _M_has_name(__imp._M_has_name), _M_name(__imp._M_name)
{
try
- { _M_facets = new __vec_facet(*(__other._M_facets)); }
+ { _M_facets = new __vec_facet(*(__imp._M_facets)); }
catch(...)
{
delete _M_facets;
}
try
- { _M_category_names = new __vec_string(*(__other._M_category_names)); }
+ { _M_category_names = new __vec_string(*(__imp._M_category_names)); }
catch(...)
{
delete _M_category_names;
// This constructor is used to correctly initialize named locales,
// including the standard "C" locale.
locale::_Impl::
- _Impl(size_t __numfacets, size_t __refs, bool __has_name = false,
- string __name)
+ _Impl(size_t __num, size_t __refs, bool __has_name, string __str)
: _M_references(__refs - 1), _M_facets(0), _M_category_names(0),
- _M_has_name(__has_name), _M_name(__name)
+ _M_has_name(__has_name), _M_name(__str)
{
try
- { _M_facets = new __vec_facet(__numfacets, NULL); }
+ { _M_facets = new __vec_facet(__num, NULL); }
catch(...)
{
delete _M_facets;
// Construct specific categories, leaving unselected ones alone
locale::_Impl::
- _Impl(const _Impl& __other, const string& __name, category __cat,
- size_t __refs)
- : _M_references(__refs - 1), _M_has_name(__other._M_name != "*")
+ _Impl(const _Impl& __imp, const string& __str, category __cat, size_t __refs)
+ : _M_references(__refs - 1)
{
__cat = _S_normalize_category(__cat); // might throw
try
- { _M_facets = new __vec_facet(*(__other._M_facets)); }
+ { _M_facets = new __vec_facet(*(__imp._M_facets)); }
catch(...)
{
delete _M_facets;
}
try
- { _M_category_names = new __vec_string(*(__other._M_category_names)); }
+ { _M_category_names = new __vec_string(*(__imp._M_category_names)); }
catch(...)
{
delete _M_category_names;
if (mask & __cat)
_M_replace_category(_S_classic, _S_facet_categories[ix]);
else
- (this->*ctors[ix])(__name.c_str());
+ (this->*ctors[ix])(__str.c_str());
}
}
catch(...)
// XXX May need to be adjusted
if (__cat == all)
- _M_name = __name;
+ _M_name = __str;
+ _M_has_name = __str != "*";
}
void
locale::_Impl::
- _M_replace_categories(const _Impl* __other, category __cat)
+ _M_replace_categories(const _Impl* __imp, category __cat)
{
category __mask = locale::all & -static_cast<unsigned int>(locale::all);
for (unsigned int __ix = 0; (-__mask & __cat) != 0; ++__ix, (__mask <<= 1))
{
if (__mask & __cat)
{
- _M_replace_category(__other, _S_facet_categories[__ix]);
- (*_M_category_names)[__ix] = (*(__other->_M_category_names))[__ix];
+ _M_replace_category(__imp, _S_facet_categories[__ix]);
+ (*_M_category_names)[__ix] = (*(__imp->_M_category_names))[__ix];
}
}
}
void
locale::_Impl::
- _M_replace_category(const _Impl* __other, const locale::id* const* __idpp)
+ _M_replace_category(const _Impl* __imp, const locale::id* const* __idpp)
{
for (; *__idpp; ++__idpp)
- _M_replace_facet(__other, *__idpp);
+ _M_replace_facet(__imp, *__idpp);
}
void
locale::_Impl::
- _M_replace_facet(const _Impl* __other, const locale::id* __idp)
+ _M_replace_facet(const _Impl* __imp, const locale::id* __idp)
{
size_t __index = __idp->_M_index;
if (__index == 0
- || __other->_M_facets->size() <= __index
- || (*(__other->_M_facets))[__index] == 0)
+ || __imp->_M_facets->size() <= __index
+ || (*(__imp->_M_facets))[__index] == 0)
throw runtime_error("no locale facet");
- _M_install_facet(__idp, (*(__other->_M_facets))[__index]);
+ _M_install_facet(__idp, (*(__imp->_M_facets))[__index]);
}
void
}
void
- locale::_Impl::_M_construct_collate(const char* __name)
+ locale::_Impl::_M_construct_collate(const char* __s)
{
- _M_facet_init(new collate_byname<char>(__name, 0));
+ _M_facet_init(new collate_byname<char>(__s, 0));
#ifdef _GLIBCPP_USE_WCHAR_T
- _M_facet_init(new collate_byname<wchar_t>(__name, 0));
+ _M_facet_init(new collate_byname<wchar_t>(__s, 0));
#endif
}
void
- locale::_Impl::_M_construct_ctype(const char* __name)
+ locale::_Impl::_M_construct_ctype(const char* __s)
{
- _M_facet_init(new ctype_byname<char>(__name, 0));
- _M_facet_init(new codecvt_byname<char, char, mbstate_t>(__name));
+ _M_facet_init(new ctype_byname<char>(__s, 0));
+ _M_facet_init(new codecvt_byname<char, char, mbstate_t>(__s));
#ifdef _GLIBCPP_USE_WCHAR_T
- _M_facet_init(new ctype_byname<wchar_t>(__name, 0));
- _M_facet_init(new codecvt_byname<wchar_t, char, mbstate_t>(__name));
+ _M_facet_init(new ctype_byname<wchar_t>(__s, 0));
+ _M_facet_init(new codecvt_byname<wchar_t, char, mbstate_t>(__s));
#endif
}
void
- locale::_Impl::_M_construct_monetary(const char* __name)
+ locale::_Impl::_M_construct_monetary(const char* __s)
{
_M_replace_facet(locale::_S_classic, &money_get<char>::id);
_M_replace_facet(locale::_S_classic, &money_put<char>::id);
- _M_facet_init(new moneypunct_byname<char, false>(__name, 0));
- _M_facet_init(new moneypunct_byname<char, true >(__name, 0));
+ _M_facet_init(new moneypunct_byname<char, false>(__s, 0));
+ _M_facet_init(new moneypunct_byname<char, true >(__s, 0));
#ifdef _GLIBCPP_USE_WCHAR_T
_M_replace_facet(locale::_S_classic, &money_get<wchar_t>::id);
_M_replace_facet(locale::_S_classic, &money_put<wchar_t>::id);
- _M_facet_init(new moneypunct_byname<wchar_t, false>(__name, 0));
- _M_facet_init(new moneypunct_byname<wchar_t, true >(__name, 0));
+ _M_facet_init(new moneypunct_byname<wchar_t, false>(__s, 0));
+ _M_facet_init(new moneypunct_byname<wchar_t, true >(__s, 0));
#endif
}
void
- locale::_Impl::_M_construct_numeric(const char* __name)
+ locale::_Impl::_M_construct_numeric(const char* __s)
{
_M_replace_facet(locale::_S_classic, &num_get<char>::id);
_M_replace_facet(locale::_S_classic, &num_put<char>::id);
- _M_facet_init(new numpunct_byname<char>(__name, 0));
+ _M_facet_init(new numpunct_byname<char>(__s, 0));
#ifdef _GLIBCPP_USE_WCHAR_T
_M_replace_facet(locale::_S_classic, &num_get<wchar_t>::id);
_M_replace_facet(locale::_S_classic, &num_put<wchar_t>::id);
- _M_facet_init(new numpunct_byname<wchar_t>(__name, 0));
+ _M_facet_init(new numpunct_byname<wchar_t>(__s, 0));
#endif
}
void
- locale::_Impl::_M_construct_time(const char* __name)
+ locale::_Impl::_M_construct_time(const char* __s)
{
- _M_facet_init(new time_get_byname<char>(__name, 0));
- _M_facet_init(new time_put_byname<char>(__name, 0));
+ _M_facet_init(new time_get_byname<char>(__s, 0));
+ _M_facet_init(new time_put_byname<char>(__s, 0));
#ifdef _GLIBCPP_USE_WCHAR_T
- _M_facet_init(new time_get_byname<wchar_t>(__name, 0));
- _M_facet_init(new time_put_byname<wchar_t>(__name, 0));
+ _M_facet_init(new time_get_byname<wchar_t>(__s, 0));
+ _M_facet_init(new time_put_byname<wchar_t>(__s, 0));
#endif
}
void
- locale::_Impl::_M_construct_messages(const char* __name)
+ locale::_Impl::_M_construct_messages(const char* __s)
{
- _M_facet_init(new messages_byname<char>(__name, 0));
+ _M_facet_init(new messages_byname<char>(__s, 0));
#ifdef _GLIBCPP_USE_WCHAR_T
- _M_facet_init(new messages_byname<wchar_t>(__name, 0));
+ _M_facet_init(new messages_byname<wchar_t>(__s, 0));
#endif
}
}