STLdoc
STLdocumentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
Classes | Public Types | Public Member Functions | Static Public Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes | List of all members
locale Class Reference
Inheritance diagram for locale:
_Locbase< int >

Classes

class  _Locimp
 
class  facet
 
class  id
 

Public Types

typedef int category
 

Public Member Functions

template<class _Elem , class _Traits , class _Alloc >
bool operator() (const basic_string< _Elem, _Traits, _Alloc > &_Left, const basic_string< _Elem, _Traits, _Alloc > &_Right) const
 
template<class _Facet >
locale combine (const locale &_Loc) const
 
template<class _Facet >
 locale (const locale &_Loc, const _Facet *_Facptr)
 
 locale (_Uninitialized)
 
 locale (const locale &_Right) _THROW0()
 
 locale () _THROW0()
 
 locale (const locale &_Loc, const locale &_Other, category _Cat)
 
 locale (const char *_Locname, category _Cat=all)
 
 locale (const locale &_Loc, const char *_Locname, category _Cat)
 
 locale (const string &_Str, category _Cat=all)
 
 locale (const locale &_Loc, const string &_Str, category _Cat)
 
 ~locale () _NOEXCEPT
 
localeoperator= (const locale &_Right) _THROW0()
 
string name () const
 
const char * c_str () const
 
const facet_Getfacet (size_t _Id) const
 
bool operator== (const locale &_Loc) const
 
bool operator!= (const locale &_Right) const
 

Static Public Member Functions

static _MRTIMP2_PURE const locale &__CLRCALL_PURE_OR_CDECL classic ()
 
static _MRTIMP2_PURE locale __CLRCALL_PURE_OR_CDECL global (const locale &)
 
static _MRTIMP2_PURE locale __CLRCALL_PURE_OR_CDECL empty ()
 

Private Member Functions

void _Construct (const string &_Str, category _Cat)
 
void _Construct (const locale &_Loc, const string &_Str, category _Cat)
 
 locale (_Locimp *_Ptrimp)
 
bool _Badname (const _Locinfo &_Lobj)
 

Static Private Member Functions

static _MRTIMP2_PURE _Locimp *__CLRCALL_PURE_OR_CDECL _Init (bool _Do_incref=false)
 
static _MRTIMP2_PURE _Locimp *__CLRCALL_PURE_OR_CDECL _Getgloballocale ()
 
static _MRTIMP2_PURE void __CLRCALL_PURE_OR_CDECL _Setgloballocale (void *)
 

Private Attributes

_Locimp_Ptr
 

Additional Inherited Members

- Static Public Attributes inherited from _Locbase< int >
static _PGLOBAL const int collate
 
static _PGLOBAL const int ctype
 
static _PGLOBAL const int monetary
 
static _PGLOBAL const int numeric
 
static _PGLOBAL const int time
 
static _PGLOBAL const int messages
 
static _PGLOBAL const int all
 
static _PGLOBAL const int none
 

Member Typedef Documentation

Constructor & Destructor Documentation

template<class _Facet >
locale::locale ( const locale _Loc,
const _Facet *  _Facptr 
)
inline
283  : _Ptr(_Locimp::_New_Locimp(*_Loc._Ptr))
284  { // construct from _Loc, replacing facet with *_Facptr
285  if (_Facptr != 0)
286  { // replace facet
287  _Ptr->_Addfac((_Facet *)_Facptr, _Facet::id);
288  if (_Facet::_Getcat() != (size_t)(-1))
289  { // no C category
290  _Ptr->_Catmask = 0;
291  _Ptr->_Name = "*";
292  }
293  }
294  }
_Locimp * _Ptr
Definition: xlocale:519
void __CLR_OR_THIS_CALL _Addfac(facet *_Pfacet, size_t _Id)
Definition: xlocale:217
category _Catmask
Definition: xlocale:238
static _MRTIMP2_PURE_NPURE _Locimp *__CLRCALL_PURE_OR_CDECL _New_Locimp(bool _Transparent=false)
_Yarn< char > _Name
Definition: xlocale:240
locale::locale ( _Uninitialized  )
inline
297  { // defer construction
298  }
locale::locale ( const locale _Right)
inline
322  : _Ptr(_Right._Ptr)
323  { // construct by copying
324  _Ptr->_Incref();
325  }
_Locimp * _Ptr
Definition: xlocale:519
virtual void __CLR_OR_THIS_CALL _Incref()
Definition: xlocale:143
locale::locale ( )
inline
328  : _Ptr(_Init(true))
329  { // construct from current locale
330  }
_Locimp * _Ptr
Definition: xlocale:519
static _MRTIMP2_PURE _Locimp *__CLRCALL_PURE_OR_CDECL _Init(bool _Do_incref=false)
locale::locale ( const locale _Loc,
const locale _Other,
category  _Cat 
)
inline
335  : _Ptr(_Locimp::_New_Locimp(*_Loc._Ptr))
336  { // construct a locale by copying named facets
337  _TRY_BEGIN
338  _BEGIN_LOCINFO(_Lobj(_Loc._Ptr->_Catmask, _Loc._Ptr->_Name.c_str()))
339  _Locimp::_Makeloc(_Lobj._Addcats(_Cat & _Other._Ptr->_Catmask,
340  _Other._Ptr->_Name.c_str()), _Cat, _Ptr, &_Other);
341  _END_LOCINFO()
342  _CATCH_ALL
343  _DELETE_CRT(_Ptr->_Decref());
344  _RERAISE;
345  _CATCH_END
346  }
#define _TRY_BEGIN
Definition: xstddef:60
#define _CATCH_END
Definition: xstddef:63
#define _DELETE_CRT(ptr)
Definition: xdebug:70
_Locimp * _Ptr
Definition: xlocale:519
const char * c_str() const
Definition: xlocale:460
const _Elem *__CLR_OR_THIS_CALL c_str() const
Definition: xutility:3396
#define _CATCH_ALL
Definition: xstddef:62
category _Catmask
Definition: xlocale:238
static _MRTIMP2_PURE_NPURE _Locimp *__CLRCALL_PURE_OR_CDECL _New_Locimp(bool _Transparent=false)
_Yarn< char > _Name
Definition: xlocale:240
#define _RERAISE
Definition: xstddef:74
locale::locale ( const char *  _Locname,
category  _Cat = all 
)
inlineexplicit
403  { // construct a locale with named facets
404  // _Locname might have been returned from setlocale().
405  // Therefore, _Construct() takes const string&.
406  if (_Locname == 0)
407  _Xruntime_error("bad locale name");
408  _Construct(_Locname, _Cat);
409  }
_Locimp * _Ptr
Definition: xlocale:519
void _Construct(const string &_Str, category _Cat)
Definition: xlocale:349
static _MRTIMP2_PURE_NPURE _Locimp *__CLRCALL_PURE_OR_CDECL _New_Locimp(bool _Transparent=false)
locale::locale ( const locale _Loc,
const char *  _Locname,
category  _Cat 
)
inline
413  : _Ptr(_Locimp::_New_Locimp(*_Loc._Ptr))
414  { // construct a locale by copying, replacing named facets
415  // _Locname might have been returned from setlocale().
416  // Therefore, _Construct() takes const string&.
417  if (_Locname == 0)
418  _Xruntime_error("bad locale name");
419  _Construct(_Loc, _Locname, _Cat);
420  }
_Locimp * _Ptr
Definition: xlocale:519
void _Construct(const string &_Str, category _Cat)
Definition: xlocale:349
static _MRTIMP2_PURE_NPURE _Locimp *__CLRCALL_PURE_OR_CDECL _New_Locimp(bool _Transparent=false)
locale::locale ( const string _Str,
category  _Cat = all 
)
inlineexplicit
425  { // construct a locale with named facets
426  _Construct(_Str, _Cat);
427  }
_Locimp * _Ptr
Definition: xlocale:519
void _Construct(const string &_Str, category _Cat)
Definition: xlocale:349
static _MRTIMP2_PURE_NPURE _Locimp *__CLRCALL_PURE_OR_CDECL _New_Locimp(bool _Transparent=false)
locale::locale ( const locale _Loc,
const string _Str,
category  _Cat 
)
inline
431  : _Ptr(_Locimp::_New_Locimp(*_Loc._Ptr))
432  { // construct a locale by copying, replacing named facets
433  _Construct(_Loc, _Str, _Cat);
434  }
_Locimp * _Ptr
Definition: xlocale:519
void _Construct(const string &_Str, category _Cat)
Definition: xlocale:349
static _MRTIMP2_PURE_NPURE _Locimp *__CLRCALL_PURE_OR_CDECL _New_Locimp(bool _Transparent=false)
locale::~locale ( )
inline
438  { // destroy the object
439  if (_Ptr != 0)
441  }
#define _DELETE_CRT(ptr)
Definition: xdebug:70
_Locimp * _Ptr
Definition: xlocale:519
virtual _Facet_base *__CLR_OR_THIS_CALL _Decref()
Definition: xlocale:148
locale::locale ( _Locimp _Ptrimp)
inlineprivate
503  : _Ptr(_Ptrimp)
504  { // construct from _Locimp pointer
505  }
_Locimp * _Ptr
Definition: xlocale:519

Member Function Documentation

bool locale::_Badname ( const _Locinfo _Lobj)
inlineprivate
515  { // test if name is "*"
516  return (_CSTD strcmp(_Lobj._Getname(), "*") == 0);
517  }
const char *__CLR_OR_THIS_CALL _Getname() const
Definition: xlocinfo:105
#define _CSTD
Definition: yvals.h:559
void locale::_Construct ( const string _Str,
category  _Cat 
)
inlineprivate
351  { // construct a locale with named facets
352  bool _Bad = false;
353  _TRY_BEGIN
354  _Init();
355  _BEGIN_LOCINFO(_Lobj(_Cat, _Str.c_str()))
356  if (_Badname(_Lobj))
357  _Bad = true;
358  else
359  _Locimp::_Makeloc(_Lobj, _Cat, _Ptr, 0);
360  _END_LOCINFO()
361  _CATCH_ALL
362  _DELETE_CRT(_Ptr->_Decref());
363  _RERAISE;
364  _CATCH_END
365 
366  if (_Bad)
367  { // Don't throw within _BEGIN_LOCINFO if we can avoid it
368  _DELETE_CRT(_Ptr->_Decref());
369  _Xruntime_error("bad locale name");
370  }
371  }
else
Definition: vccorlib.h:1721
#define _TRY_BEGIN
Definition: xstddef:60
#define _CATCH_END
Definition: xstddef:63
#define _DELETE_CRT(ptr)
Definition: xdebug:70
_Locimp * _Ptr
Definition: xlocale:519
const _Elem * c_str() const _NOEXCEPT
Definition: xstring:1737
bool _Badname(const _Locinfo &_Lobj)
Definition: xlocale:514
#define _CATCH_ALL
Definition: xstddef:62
if(__pUnknown!=*__ppTargetUnknown)
Definition: vccorlib.h:394
#define _RERAISE
Definition: xstddef:74
#define true
Definition: stdbool.h:12
static _MRTIMP2_PURE _Locimp *__CLRCALL_PURE_OR_CDECL _Init(bool _Do_incref=false)
void locale::_Construct ( const locale _Loc,
const string _Str,
category  _Cat 
)
inlineprivate
375  { // construct a locale by copying, replacing named facets
376  bool _Bad = false;
377  _TRY_BEGIN
378  _BEGIN_LOCINFO(_Lobj(_Loc._Ptr->_Catmask, _Loc._Ptr->_Name.c_str()))
379  bool _Hadname = !_Badname(_Lobj);
380  _Lobj._Addcats(_Cat, _Str.c_str());
381 
382  if (_Hadname && _Badname(_Lobj))
383  _Bad = true;
384  else
385  _Locimp::_Makeloc(_Lobj, _Cat, _Ptr, 0);
386  _END_LOCINFO()
387  _CATCH_ALL
388  _DELETE_CRT(_Ptr->_Decref());
389  _RERAISE;
390  _CATCH_END
391 
392  if (_Bad)
393  { // Don't throw within _BEGIN_LOCINFO if we can avoid it
394  _DELETE_CRT(_Ptr->_Decref());
395  _Xruntime_error("bad locale name");
396  }
397  }
else
Definition: vccorlib.h:1721
#define _TRY_BEGIN
Definition: xstddef:60
#define _CATCH_END
Definition: xstddef:63
#define _DELETE_CRT(ptr)
Definition: xdebug:70
_Locimp * _Ptr
Definition: xlocale:519
const char * c_str() const
Definition: xlocale:460
const _Elem *__CLR_OR_THIS_CALL c_str() const
Definition: xutility:3396
#define bool
Definition: stdbool.h:10
bool _Badname(const _Locinfo &_Lobj)
Definition: xlocale:514
#define _CATCH_ALL
Definition: xstddef:62
category _Catmask
Definition: xlocale:238
if(__pUnknown!=*__ppTargetUnknown)
Definition: vccorlib.h:394
_Yarn< char > _Name
Definition: xlocale:240
#define _RERAISE
Definition: xstddef:74
#define true
Definition: stdbool.h:12
const facet* locale::_Getfacet ( size_t  _Id) const
inline
466  { // look up a facet in locale object
467  const facet *_Facptr = _Id < _Ptr->_Facetcount
468  ? _Ptr->_Facetvec[_Id] : 0; // null if id off end
469  if (_Facptr != 0 || !_Ptr->_Xparent)
470  return (_Facptr); // found facet or not transparent
471  else
472  { // look in current locale
474  return (_Id < _Ptr->_Facetcount
475  ? _Ptr->_Facetvec[_Id] // get from current locale
476  : 0); // no entry in current locale
477  }
478  }
_Locimp * _Ptr
Definition: xlocale:519
Definition: xlocale:178
size_t _Facetcount
Definition: xlocale:237
bool _Xparent
Definition: xlocale:239
static _MRTIMP2_PURE _Locimp *__CLRCALL_PURE_OR_CDECL _Getgloballocale()
facet ** _Facetvec
Definition: xlocale:236
static _MRTIMP2_PURE _Locimp* __CLRCALL_PURE_OR_CDECL locale::_Getgloballocale ( )
staticprivate
static _MRTIMP2_PURE _Locimp* __CLRCALL_PURE_OR_CDECL locale::_Init ( bool  _Do_incref = false)
staticprivate
static _MRTIMP2_PURE void __CLRCALL_PURE_OR_CDECL locale::_Setgloballocale ( void )
staticprivate
const char* locale::c_str ( ) const
inline
461  { // return locale name as NTBS
462  return (_Ptr == 0 ? "" : _Ptr->_Name.c_str());
463  }
_Locimp * _Ptr
Definition: xlocale:519
const _Elem *__CLR_OR_THIS_CALL c_str() const
Definition: xutility:3396
_Yarn< char > _Name
Definition: xlocale:240
static _MRTIMP2_PURE const locale& __CLRCALL_PURE_OR_CDECL locale::classic ( )
static
template<class _Facet >
locale locale::combine ( const locale _Loc) const
inline
265  { // combine two locales
266  _Facet *_Facptr;
267 
268  _TRY_BEGIN
269  _Facptr = (_Facet *)&use_facet<_Facet>(_Loc);
270  _CATCH_ALL
271  _Xruntime_error("locale::combine facet missing");
272  _CATCH_END
273 
274  _Locimp *_Newimp = _Locimp::_New_Locimp(*_Ptr);
275  _Newimp->_Addfac(_Facptr, _Facet::id);
276  _Newimp->_Catmask = 0;
277  _Newimp->_Name = "*";
278  return (locale(_Newimp));
279  }
#define _TRY_BEGIN
Definition: xstddef:60
#define _CATCH_END
Definition: xstddef:63
_Locimp * _Ptr
Definition: xlocale:519
locale() _THROW0()
Definition: xlocale:327
#define _CATCH_ALL
Definition: xstddef:62
static _MRTIMP2_PURE_NPURE _Locimp *__CLRCALL_PURE_OR_CDECL _New_Locimp(bool _Transparent=false)
static _MRTIMP2_PURE locale __CLRCALL_PURE_OR_CDECL locale::empty ( )
static
static _MRTIMP2_PURE locale __CLRCALL_PURE_OR_CDECL locale::global ( const locale )
static
string locale::name ( ) const
inline
456  { // return locale name
457  return (_Ptr == 0 ? string() : _Ptr->_Name.c_str());
458  }
_Locimp * _Ptr
Definition: xlocale:519
const _Elem *__CLR_OR_THIS_CALL c_str() const
Definition: xutility:3396
_Yarn< char > _Name
Definition: xlocale:240
bool locale::operator!= ( const locale _Right) const
inline
488  { // test for locale inequality
489  return (!(*this == _Right));
490  }
template<class _Elem , class _Traits , class _Alloc >
bool locale::operator() ( const basic_string< _Elem, _Traits, _Alloc > &  _Left,
const basic_string< _Elem, _Traits, _Alloc > &  _Right 
) const
inline
255  { // compare _Left and _Right strings using collate facet in locale
256  const _STD collate<_Elem>& _Coll_fac =
257  use_facet<_STD collate<_Elem> >(*this);
258 
259  return (_Coll_fac.compare(_Left.c_str(), _Left.c_str() + _Left.size(),
260  _Right.c_str(), _Right.c_str() + _Right.size()) < 0);
261  }
const _Elem * c_str() const _NOEXCEPT
Definition: xstring:1737
size_type size() const _NOEXCEPT
Definition: xstring:1752
Definition: locale:23
locale& locale::operator= ( const locale _Right)
inline
444  { // assign a locale
445  if (_Ptr != _Right._Ptr)
446  { // different implementation, point at new one
448  _Ptr = _Right._Ptr;
449  _Ptr->_Incref();
450  }
451  return (*this);
452  }
#define _DELETE_CRT(ptr)
Definition: xdebug:70
_Locimp * _Ptr
Definition: xlocale:519
virtual void __CLR_OR_THIS_CALL _Incref()
Definition: xlocale:143
virtual _Facet_base *__CLR_OR_THIS_CALL _Decref()
Definition: xlocale:148
bool locale::operator== ( const locale _Loc) const
inline
481  { // compare locales for equality
482  return (_Ptr == _Loc._Ptr
483  || (name().compare("*") != 0
484  && name().compare(_Loc.name()) == 0));
485  }
_Locimp * _Ptr
Definition: xlocale:519
string name() const
Definition: xlocale:455

Member Data Documentation

_Locimp* locale::_Ptr
private

The documentation for this class was generated from the following file: