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
 
_Ret_z_ const charc_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

Constructor & Destructor Documentation

template<class _Facet >
locale::locale ( const locale _Loc,
const _Facet *  _Facptr 
)
inline
282  : _Ptr(_Locimp::_New_Locimp(*_Loc._Ptr))
283  { // construct from _Loc, replacing facet with *_Facptr
284  if (_Facptr != 0)
285  { // replace facet
286  _Ptr->_Addfac((_Facet *)_Facptr, _Facet::id);
287  _Ptr->_Catmask = none;
288  _Ptr->_Name = "*";
289  }
290  }
static _PGLOBAL const int none
Definition: xlocale:33
_Locimp * _Ptr
Definition: xlocale:483
void __CLR_OR_THIS_CALL _Addfac(facet *_Pfacet, size_t _Id)
Definition: xlocale:218
category _Catmask
Definition: xlocale:239
static _MRTIMP2_PURE_NPURE _Locimp *__CLRCALL_PURE_OR_CDECL _New_Locimp(bool _Transparent=false)
_Yarn< char > _Name
Definition: xlocale:241
locale::locale ( _Uninitialized  )
inline
293  { // defer construction
294  }
locale::locale ( const locale _Right)
inline
297  : _Ptr(_Right._Ptr)
298  { // construct by copying
299  _Ptr->_Incref();
300  }
_Locimp * _Ptr
Definition: xlocale:483
virtual void __CLR_OR_THIS_CALL _Incref()
Definition: xlocale:147
locale::locale ( )
inline
303  : _Ptr(_Init(true))
304  { // construct from current locale
305  }
_Locimp * _Ptr
Definition: xlocale:483
static _MRTIMP2_PURE _Locimp *__CLRCALL_PURE_OR_CDECL _Init(bool _Do_incref=false)
locale::locale ( const locale _Loc,
const locale _Other,
category  _Cat 
)
inline
310  : _Ptr(_Locimp::_New_Locimp(*_Loc._Ptr))
311  { // construct a locale by copying named facets
312  if (_Cat != none)
313  { // worth adding, do it
314  _TRY_BEGIN
315  _BEGIN_LOCINFO(_Lobj)
316  _Locimp::_Makeloc(_Lobj, _Cat, _Ptr, &_Other);
317  _Lobj._Addcats(_Loc._Ptr->_Catmask,
318  _Loc.name().c_str());
319  _Lobj._Addcats(_Other._Ptr->_Catmask,
320  _Other.name().c_str());
321  _Ptr->_Catmask = _Loc._Ptr->_Catmask
322  | _Other._Ptr->_Catmask;
323  _Ptr->_Name = _Lobj._Getname();
324  _END_LOCINFO()
325  _CATCH_ALL
326  delete _Ptr->_Decref();
327  _RERAISE;
328  _CATCH_END
329  }
330  }
#define _TRY_BEGIN
Definition: xstddef:26
static _PGLOBAL const int none
Definition: xlocale:33
#define _CATCH_END
Definition: xstddef:29
_Locimp * _Ptr
Definition: xlocale:483
_Ret_z_ const char * c_str() const
Definition: xlocale:424
#define _CATCH_ALL
Definition: xstddef:28
static _MRTIMP2_PURE_NPURE _Locimp *__CLRCALL_PURE_OR_CDECL _New_Locimp(bool _Transparent=false)
string name() const
Definition: xlocale:419
#define _RERAISE
Definition: xstddef:32
locale::locale ( const char _Locname,
category  _Cat = all 
)
inlineexplicit
368  { // construct a locale with named facets
369  // _Locname might have been returned from setlocale().
370  // Therefore, _Construct() takes const string&.
371  if (_Locname == 0)
372  _Xruntime_error("bad locale name");
373  _Construct(_Locname, _Cat);
374  }
_Locimp * _Ptr
Definition: xlocale:483
void _Construct(const string &_Str, category _Cat)
Definition: xlocale:333
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
378  : _Ptr(_Locimp::_New_Locimp(*_Loc._Ptr))
379  { // construct a locale by copying, replacing named facets
380  // _Locname might have been returned from setlocale().
381  // Therefore, _Construct() takes const string&.
382  if (_Locname == 0)
383  _Xruntime_error("bad locale name");
384  _Construct(_Locname, _Cat);
385  }
_Locimp * _Ptr
Definition: xlocale:483
void _Construct(const string &_Str, category _Cat)
Definition: xlocale:333
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
390  { // construct a locale with named facets
391  _Construct(_Str, _Cat);
392  }
_Locimp * _Ptr
Definition: xlocale:483
void _Construct(const string &_Str, category _Cat)
Definition: xlocale:333
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
396  : _Ptr(_Locimp::_New_Locimp(*_Loc._Ptr))
397  { // construct a locale by copying, replacing named facets
398  _Construct(_Str, _Cat);
399  }
_Locimp * _Ptr
Definition: xlocale:483
void _Construct(const string &_Str, category _Cat)
Definition: xlocale:333
static _MRTIMP2_PURE_NPURE _Locimp *__CLRCALL_PURE_OR_CDECL _New_Locimp(bool _Transparent=false)
locale::~locale ( )
inline
403  { // destroy the object
404  if (_Ptr != 0)
405  delete _Ptr->_Decref();
406  }
_Locimp * _Ptr
Definition: xlocale:483
virtual _Facet_base *__CLR_OR_THIS_CALL _Decref()
Definition: xlocale:152
locale::locale ( _Locimp _Ptrimp)
inlineprivate
467  : _Ptr(_Ptrimp)
468  { // construct from _Locimp pointer
469  }
_Locimp * _Ptr
Definition: xlocale:483

Member Function Documentation

bool locale::_Badname ( const _Locinfo _Lobj)
inlineprivate
479  { // test if name is "*"
480  return (_CSTD strcmp(_Lobj._Getname(), "*") == 0);
481  }
const char *__CLR_OR_THIS_CALL _Getname() const
Definition: xlocinfo:104
_In_z_ char const _Source _Check_return_ int __cdecl strcmp(_In_z_ char const *_Str1, _In_z_ char const *_Str2)
#define _CSTD
Definition: yvals.h:570
void locale::_Construct ( const string _Str,
category  _Cat 
)
inlineprivate
335  { // construct a locale with named facets
336  bool _Bad = false;
337  _Init();
338  if (_Cat != none)
339  { // worth adding, do it
340  _TRY_BEGIN
341  _BEGIN_LOCINFO(_Lobj(_Cat, _Str.c_str()))
342  if (_Badname(_Lobj))
343  _Bad = true;
344  else
345  { // name okay, build the locale
346  _Locimp::_Makeloc(_Lobj, _Cat, _Ptr, 0);
347  _Ptr->_Catmask = _Cat;
348  _Ptr->_Name = _Str.c_str();
349  }
350  _END_LOCINFO()
351  _CATCH_ALL
352  delete _Ptr->_Decref();
353  _RERAISE;
354  _CATCH_END
355  }
356 
357  if (_Bad)
358  { // Don't throw within _BEGIN_LOCINFO if we can avoid it
359  delete _Ptr->_Decref();
360  _Xruntime_error("bad locale name");
361  }
362  }
_Ret_z_ const _Elem * c_str() const _NOEXCEPT
Definition: xstring:3001
#define _TRY_BEGIN
Definition: xstddef:26
static _PGLOBAL const int none
Definition: xlocale:33
#define _CATCH_END
Definition: xstddef:29
_Locimp * _Ptr
Definition: xlocale:483
if(_Source==NULL||_DestinationSize< _SourceSize)
Definition: corecrt_memcpy_s.h:48
else
Definition: variant:945
static _Locimp *__CLRCALL_OR_CDECL _Makeloc(const _Locinfo &, category, _Locimp *, const locale *)
bool _Badname(const _Locinfo &_Lobj)
Definition: xlocale:478
virtual _Facet_base *__CLR_OR_THIS_CALL _Decref()
Definition: xlocale:152
#define _CATCH_ALL
Definition: xstddef:28
category _Catmask
Definition: xlocale:239
_Yarn< char > _Name
Definition: xlocale:241
_CRTIMP2_PURE void __CLRCALL_PURE_OR_CDECL _Xruntime_error(_In_z_ const char *)
#define _RERAISE
Definition: xstddef:32
#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
430  { // look up a facet in locale object
431  const facet *_Facptr = _Id < _Ptr->_Facetcount
432  ? _Ptr->_Facetvec[_Id] : 0; // null if id off end
433  if (_Facptr != 0 || !_Ptr->_Xparent)
434  return (_Facptr); // found facet or not transparent
435  else
436  { // look in current locale
438  return (_Id < _Ptr0->_Facetcount
439  ? _Ptr0->_Facetvec[_Id] // get from current locale
440  : 0); // no entry in current locale
441  }
442  }
_Locimp * _Ptr
Definition: xlocale:483
Definition: xlocale:179
size_t _Facetcount
Definition: xlocale:238
bool _Xparent
Definition: xlocale:240
static _MRTIMP2_PURE _Locimp *__CLRCALL_PURE_OR_CDECL _Getgloballocale()
facet ** _Facetvec
Definition: xlocale:237
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
_Ret_z_ const char* locale::c_str ( ) const
inline
425  { // return locale name as NTBS
426  return (_Ptr == 0 ? "" : _Ptr->_Name.c_str());
427  }
_Locimp * _Ptr
Definition: xlocale:483
_Ret_z_ const _Elem *__CLR_OR_THIS_CALL c_str() const
Definition: xutility:3662
_Yarn< char > _Name
Definition: xlocale:241
static _MRTIMP2_PURE const locale& __CLRCALL_PURE_OR_CDECL locale::classic ( )
static
template<class _Facet >
locale locale::combine ( const locale _Loc) const
inline
264  { // combine two locales
265  _Facet *_Facptr;
266 
267  _TRY_BEGIN
268  _Facptr = (_Facet *)&use_facet<_Facet>(_Loc);
269  _CATCH_ALL
270  _Xruntime_error("locale::combine facet missing");
271  _CATCH_END
272 
273  _Locimp *_Newimp = _Locimp::_New_Locimp(*_Ptr);
274  _Newimp->_Addfac(_Facptr, _Facet::id);
275  _Newimp->_Catmask = none;
276  _Newimp->_Name = "*";
277  return (locale(_Newimp));
278  }
#define _TRY_BEGIN
Definition: xstddef:26
static _PGLOBAL const int none
Definition: xlocale:33
#define _CATCH_END
Definition: xstddef:29
_Locimp * _Ptr
Definition: xlocale:483
locale() _THROW0()
Definition: xlocale:302
#define _CATCH_ALL
Definition: xstddef:28
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
420  { // return locale name
421  return (_Ptr == 0 ? string() : _Ptr->_Name.c_str());
422  }
_Locimp * _Ptr
Definition: xlocale:483
_Ret_z_ const _Elem *__CLR_OR_THIS_CALL c_str() const
Definition: xutility:3662
_Yarn< char > _Name
Definition: xlocale:241
bool locale::operator!= ( const locale _Right) const
inline
452  { // test for locale inequality
453  return (!(*this == _Right));
454  }
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
254  { // compare _Left and _Right strings using collate facet in locale
255  const _STD collate<_Elem>& _Coll_fac =
256  use_facet< _STD collate<_Elem> >(*this);
257 
258  return (_Coll_fac.compare(_Left.c_str(), _Left.c_str() + _Left.size(),
259  _Right.c_str(), _Right.c_str() + _Right.size()) < 0);
260  }
_Ret_z_ const _Elem * c_str() const _NOEXCEPT
Definition: xstring:3001
size_type size() const _NOEXCEPT
Definition: xstring:3023
Definition: locale:24
locale& locale::operator= ( const locale _Right)
inline
409  { // assign a locale
410  if (_Ptr != _Right._Ptr)
411  { // different implementation, point at new one
412  delete _Ptr->_Decref();
413  _Ptr = _Right._Ptr;
414  _Ptr->_Incref();
415  }
416  return (*this);
417  }
_Locimp * _Ptr
Definition: xlocale:483
virtual void __CLR_OR_THIS_CALL _Incref()
Definition: xlocale:147
virtual _Facet_base *__CLR_OR_THIS_CALL _Decref()
Definition: xlocale:152
bool locale::operator== ( const locale _Loc) const
inline
445  { // compare locales for equality
446  return (_Ptr == _Loc._Ptr
447  || (name().compare("*") != 0
448  && name().compare(_Loc.name()) == 0));
449  }
_Locimp * _Ptr
Definition: xlocale:483
string name() const
Definition: xlocale:419

Member Data Documentation

_Locimp* locale::_Ptr
private

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