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 > _Crt_new_delete

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)
 
 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

typedef int locale::category

Constructor & Destructor Documentation

template<class _Facet >
locale::locale ( const locale _Loc,
const _Facet *  _Facptr 
)
inline
288  : _Ptr(_Locimp::_New_Locimp(*_Loc._Ptr))
289  { // construct from _Loc, replacing facet with *_Facptr
290  if (_Facptr != 0)
291  { // replace facet
292  _Ptr->_Addfac((_Facet *)_Facptr, _Facet::id);
293  _Ptr->_Catmask = none;
294  _Ptr->_Name = "*";
295  }
296  }
static _PGLOBAL const int none
Definition: xlocale:34
_Locimp * _Ptr
Definition: xlocale:511
void __CLR_OR_THIS_CALL _Addfac(facet *_Pfacet, size_t _Id)
Definition: xlocale:222
category _Catmask
Definition: xlocale:243
static _MRTIMP2_PURE_NPURE _Locimp *__CLRCALL_PURE_OR_CDECL _New_Locimp(bool _Transparent=false)
_Yarn< char > _Name
Definition: xlocale:245
locale::locale ( _Uninitialized  )
inline
299  { // defer construction
300  }
locale::locale ( const locale _Right)
inline
324  : _Ptr(_Right._Ptr)
325  { // construct by copying
326  _Ptr->_Incref();
327  }
_Locimp * _Ptr
Definition: xlocale:511
virtual void __CLR_OR_THIS_CALL _Incref()
Definition: xlocale:148
locale::locale ( )
inline
330  : _Ptr(_Init(true))
331  { // construct from current locale
332  }
_Locimp * _Ptr
Definition: xlocale:511
static _MRTIMP2_PURE _Locimp *__CLRCALL_PURE_OR_CDECL _Init(bool _Do_incref=false)
locale::locale ( const locale _Loc,
const locale _Other,
category  _Cat 
)
inline
337  : _Ptr(_Locimp::_New_Locimp(*_Loc._Ptr))
338  { // construct a locale by copying named facets
339  if (_Cat != none)
340  { // worth adding, do it
341  _TRY_BEGIN
342  _BEGIN_LOCINFO(_Lobj)
343  _Locimp::_Makeloc(_Lobj, _Cat, _Ptr, &_Other);
344  _Lobj._Addcats(_Loc._Ptr->_Catmask,
345  _Loc.name().c_str());
346  _Lobj._Addcats(_Other._Ptr->_Catmask,
347  _Other.name().c_str());
348  _Ptr->_Catmask = _Loc._Ptr->_Catmask
349  | _Other._Ptr->_Catmask;
350  _Ptr->_Name = _Lobj._Getname();
351  _END_LOCINFO()
352  _CATCH_ALL
353  delete _Ptr->_Decref();
354  _RERAISE;
355  _CATCH_END
356  }
357  }
#define _TRY_BEGIN
Definition: xstddef:60
static _PGLOBAL const int none
Definition: xlocale:34
#define _CATCH_END
Definition: xstddef:63
_Locimp * _Ptr
Definition: xlocale:511
const char * c_str() const
Definition: xlocale:452
#define _CATCH_ALL
Definition: xstddef:62
static _MRTIMP2_PURE_NPURE _Locimp *__CLRCALL_PURE_OR_CDECL _New_Locimp(bool _Transparent=false)
string name() const
Definition: xlocale:447
#define _RERAISE
Definition: xstddef:74
locale::locale ( const char *  _Locname,
category  _Cat = all 
)
inlineexplicit
395  { // construct a locale with named facets
396  // _Locname might have been returned from setlocale().
397  // Therefore, _Construct() takes const string&.
398  if (_Locname == 0)
399  _Xruntime_error("bad locale name");
400  _Construct(_Locname, _Cat);
401  }
_Locimp * _Ptr
Definition: xlocale:511
void _Construct(const string &_Str, category _Cat)
Definition: xlocale:360
static _MRTIMP2_PURE_NPURE _Locimp *__CLRCALL_PURE_OR_CDECL _New_Locimp(bool _Transparent=false)
_CRTIMP2_PURE void __CLRCALL_PURE_OR_CDECL _Xruntime_error(_In_z_ const char *)
locale::locale ( const locale _Loc,
const char *  _Locname,
category  _Cat 
)
inline
405  : _Ptr(_Locimp::_New_Locimp(*_Loc._Ptr))
406  { // construct a locale by copying, replacing named facets
407  // _Locname might have been returned from setlocale().
408  // Therefore, _Construct() takes const string&.
409  if (_Locname == 0)
410  _Xruntime_error("bad locale name");
411  _Construct(_Locname, _Cat);
412  }
_Locimp * _Ptr
Definition: xlocale:511
void _Construct(const string &_Str, category _Cat)
Definition: xlocale:360
static _MRTIMP2_PURE_NPURE _Locimp *__CLRCALL_PURE_OR_CDECL _New_Locimp(bool _Transparent=false)
_CRTIMP2_PURE void __CLRCALL_PURE_OR_CDECL _Xruntime_error(_In_z_ const char *)
locale::locale ( const string _Str,
category  _Cat = all 
)
inlineexplicit
417  { // construct a locale with named facets
418  _Construct(_Str, _Cat);
419  }
_Locimp * _Ptr
Definition: xlocale:511
void _Construct(const string &_Str, category _Cat)
Definition: xlocale:360
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
423  : _Ptr(_Locimp::_New_Locimp(*_Loc._Ptr))
424  { // construct a locale by copying, replacing named facets
425  _Construct(_Str, _Cat);
426  }
_Locimp * _Ptr
Definition: xlocale:511
void _Construct(const string &_Str, category _Cat)
Definition: xlocale:360
static _MRTIMP2_PURE_NPURE _Locimp *__CLRCALL_PURE_OR_CDECL _New_Locimp(bool _Transparent=false)
locale::~locale ( )
inline
430  { // destroy the object
431  if (_Ptr != 0)
432  delete _Ptr->_Decref();
433  }
_Locimp * _Ptr
Definition: xlocale:511
virtual _Facet_base *__CLR_OR_THIS_CALL _Decref()
Definition: xlocale:153
locale::locale ( _Locimp _Ptrimp)
inlineprivate
495  : _Ptr(_Ptrimp)
496  { // construct from _Locimp pointer
497  }
_Locimp * _Ptr
Definition: xlocale:511

Member Function Documentation

bool locale::_Badname ( const _Locinfo _Lobj)
inlineprivate
507  { // test if name is "*"
508  return (_CSTD strcmp(_Lobj._Getname(), "*") == 0);
509  }
const char *__CLR_OR_THIS_CALL _Getname() const
Definition: xlocinfo:105
#define _CSTD
Definition: yvals.h:570
void locale::_Construct ( const string _Str,
category  _Cat 
)
inlineprivate
362  { // construct a locale with named facets
363  bool _Bad = false;
364  _Init();
365  if (_Cat != none)
366  { // worth adding, do it
367  _TRY_BEGIN
368  _BEGIN_LOCINFO(_Lobj(_Cat, _Str.c_str()))
369  if (_Badname(_Lobj))
370  _Bad = true;
371  else
372  { // name okay, build the locale
373  _Locimp::_Makeloc(_Lobj, _Cat, _Ptr, 0);
374  _Ptr->_Catmask = _Cat;
375  _Ptr->_Name = _Str.c_str();
376  }
377  _END_LOCINFO()
378  _CATCH_ALL
379  delete _Ptr->_Decref();
380  _RERAISE;
381  _CATCH_END
382  }
383 
384  if (_Bad)
385  { // Don't throw within _BEGIN_LOCINFO if we can avoid it
386  delete _Ptr->_Decref();
387  _Xruntime_error("bad locale name");
388  }
389  }
else
Definition: vccorlib.h:1729
#define _TRY_BEGIN
Definition: xstddef:60
static _PGLOBAL const int none
Definition: xlocale:34
#define _CATCH_END
Definition: xstddef:63
_Locimp * _Ptr
Definition: xlocale:511
const _Elem * c_str() const _NOEXCEPT
Definition: xstring:1741
static _Locimp *__CLRCALL_OR_CDECL _Makeloc(const _Locinfo &, category, _Locimp *, const locale *)
bool _Badname(const _Locinfo &_Lobj)
Definition: xlocale:506
virtual _Facet_base *__CLR_OR_THIS_CALL _Decref()
Definition: xlocale:153
#define _CATCH_ALL
Definition: xstddef:62
category _Catmask
Definition: xlocale:243
if(__pUnknown!=*__ppTargetUnknown)
Definition: vccorlib.h:399
_Yarn< char > _Name
Definition: xlocale:245
_CRTIMP2_PURE void __CLRCALL_PURE_OR_CDECL _Xruntime_error(_In_z_ const char *)
#define _RERAISE
Definition: xstddef:74
#define true
Definition: stdbool.h:17
static _MRTIMP2_PURE _Locimp *__CLRCALL_PURE_OR_CDECL _Init(bool _Do_incref=false)
const facet* locale::_Getfacet ( size_t  _Id) const
inline
458  { // look up a facet in locale object
459  const facet *_Facptr = _Id < _Ptr->_Facetcount
460  ? _Ptr->_Facetvec[_Id] : 0; // null if id off end
461  if (_Facptr != 0 || !_Ptr->_Xparent)
462  return (_Facptr); // found facet or not transparent
463  else
464  { // look in current locale
466  return (_Id < _Ptr0->_Facetcount
467  ? _Ptr0->_Facetvec[_Id] // get from current locale
468  : 0); // no entry in current locale
469  }
470  }
_Locimp * _Ptr
Definition: xlocale:511
Definition: xlocale:183
size_t _Facetcount
Definition: xlocale:242
bool _Xparent
Definition: xlocale:244
static _MRTIMP2_PURE _Locimp *__CLRCALL_PURE_OR_CDECL _Getgloballocale()
facet ** _Facetvec
Definition: xlocale:241
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
453  { // return locale name as NTBS
454  return (_Ptr == 0 ? "" : _Ptr->_Name.c_str());
455  }
_Locimp * _Ptr
Definition: xlocale:511
const _Elem *__CLR_OR_THIS_CALL c_str() const
Definition: xutility:3779
_Yarn< char > _Name
Definition: xlocale:245
static _MRTIMP2_PURE const locale& __CLRCALL_PURE_OR_CDECL locale::classic ( )
static
template<class _Facet >
locale locale::combine ( const locale _Loc) const
inline
270  { // combine two locales
271  _Facet *_Facptr;
272 
273  _TRY_BEGIN
274  _Facptr = (_Facet *)&use_facet<_Facet>(_Loc);
275  _CATCH_ALL
276  _Xruntime_error("locale::combine facet missing");
277  _CATCH_END
278 
279  _Locimp *_Newimp = _Locimp::_New_Locimp(*_Ptr);
280  _Newimp->_Addfac(_Facptr, _Facet::id);
281  _Newimp->_Catmask = none;
282  _Newimp->_Name = "*";
283  return (locale(_Newimp));
284  }
#define _TRY_BEGIN
Definition: xstddef:60
static _PGLOBAL const int none
Definition: xlocale:34
#define _CATCH_END
Definition: xstddef:63
_Locimp * _Ptr
Definition: xlocale:511
locale() _THROW0()
Definition: xlocale:329
#define _CATCH_ALL
Definition: xstddef:62
static _MRTIMP2_PURE_NPURE _Locimp *__CLRCALL_PURE_OR_CDECL _New_Locimp(bool _Transparent=false)
_CRTIMP2_PURE void __CLRCALL_PURE_OR_CDECL _Xruntime_error(_In_z_ const char *)
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
448  { // return locale name
449  return (_Ptr == 0 ? string() : _Ptr->_Name.c_str());
450  }
_Locimp * _Ptr
Definition: xlocale:511
const _Elem *__CLR_OR_THIS_CALL c_str() const
Definition: xutility:3779
_Yarn< char > _Name
Definition: xlocale:245
bool locale::operator!= ( const locale _Right) const
inline
480  { // test for locale inequality
481  return (!(*this == _Right));
482  }
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
260  { // compare _Left and _Right strings using collate facet in locale
261  const _STD collate<_Elem>& _Coll_fac =
262  use_facet< _STD collate<_Elem> >(*this);
263 
264  return (_Coll_fac.compare(_Left.c_str(), _Left.c_str() + _Left.size(),
265  _Right.c_str(), _Right.c_str() + _Right.size()) < 0);
266  }
const _Elem * c_str() const _NOEXCEPT
Definition: xstring:1741
size_type size() const _NOEXCEPT
Definition: xstring:1763
Definition: locale:23
locale& locale::operator= ( const locale _Right)
inline
436  { // assign a locale
437  if (_Ptr != _Right._Ptr)
438  { // different implementation, point at new one
439  delete _Ptr->_Decref();
440  _Ptr = _Right._Ptr;
441  _Ptr->_Incref();
442  }
443  return (*this);
444  }
_Locimp * _Ptr
Definition: xlocale:511
virtual void __CLR_OR_THIS_CALL _Incref()
Definition: xlocale:148
virtual _Facet_base *__CLR_OR_THIS_CALL _Decref()
Definition: xlocale:153
bool locale::operator== ( const locale _Loc) const
inline
473  { // compare locales for equality
474  return (_Ptr == _Loc._Ptr
475  || (name().compare("*") != 0
476  && name().compare(_Loc.name()) == 0));
477  }
_Locimp * _Ptr
Definition: xlocale:511
string name() const
Definition: xlocale:447

Member Data Documentation

_Locimp* locale::_Ptr
private

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