STLdoc
STLdocumentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Member Functions | Private Attributes | List of all members
collate< _Elem > Class Template Reference
Inheritance diagram for collate< _Elem >:
locale::facet _Facet_base collate_byname< _Elem >

Public Types

typedef _Elem char_type
 
typedef basic_string< _Elem, char_traits< _Elem >, allocator< _Elem > > string_type
 

Public Member Functions

int compare (const _Elem *_First1, const _Elem *_Last1, const _Elem *_First2, const _Elem *_Last2) const
 
string_type transform (const _Elem *_First, const _Elem *_Last) const
 
long hash (const _Elem *_First, const _Elem *_Last) const
 
 collate (size_t _Refs=0)
 
 collate (const _Locinfo &_Lobj, size_t _Refs=0)
 
- Public Member Functions inherited from locale::facet
virtual void __CLR_OR_THIS_CALL _Incref ()
 
virtual _Facet_base *__CLR_OR_THIS_CALL _Decref ()
 
__CLR_OR_THIS_CALL facet (const facet &)=delete
 
facet &__CLR_OR_THIS_CALL operator= (const facet &)=delete
 
- Public Member Functions inherited from _Facet_base
virtual __CLR_OR_THIS_CALL ~_Facet_base () _NOEXCEPT
 

Static Public Member Functions

static size_t _Getcat (const locale::facet **_Ppf=0, const locale *_Ploc=0)
 
- Static Public Member Functions inherited from locale::facet
static size_t __CLRCALL_OR_CDECL _Getcat (const facet **=0, const locale *=0)
 

Static Public Attributes

__PURE_APPDOMAIN_GLOBAL static _CRTIMP2_PURE locale::id id
 

Protected Member Functions

__CLR_OR_THIS_CALL ~collate () _NOEXCEPT
 
 collate (const char *_Locname, size_t _Refs=0)
 
void _Init (const _Locinfo &_Lobj)
 
virtual int __CLR_OR_THIS_CALL do_compare (const _Elem *_First1, const _Elem *_Last1, const _Elem *_First2, const _Elem *_Last2) const
 
virtual string_type __CLR_OR_THIS_CALL do_transform (const _Elem *_First, const _Elem *_Last) const
 
virtual long __CLR_OR_THIS_CALL do_hash (const _Elem *_First, const _Elem *_Last) const
 
- Protected Member Functions inherited from locale::facet
__CLR_OR_THIS_CALL facet (size_t _Initrefs=0)
 
virtual __CLR_OR_THIS_CALL ~facet () _NOEXCEPT
 

Private Attributes

_Locinfo::_Collvec _Coll
 

Member Typedef Documentation

template<class _Elem>
typedef _Elem collate< _Elem >::char_type
template<class _Elem>
typedef basic_string<_Elem, char_traits<_Elem>, allocator<_Elem> > collate< _Elem >::string_type

Constructor & Destructor Documentation

template<class _Elem>
collate< _Elem >::collate ( size_t  _Refs = 0)
inlineexplicit
51  { // construct from current locale
52  _BEGIN_LOCINFO(_Lobj)
53  _Init(_Lobj);
54  _END_LOCINFO()
55  }
Definition: xlocale:102
_Atomic_counter_t _Refs
Definition: xlocale:157
void _Init(const _Locinfo &_Lobj)
Definition: locale:87
template<class _Elem>
collate< _Elem >::collate ( const _Locinfo _Lobj,
size_t  _Refs = 0 
)
inline
59  { // construct from specified locale
60  _Init(_Lobj);
61  }
Definition: xlocale:102
_Atomic_counter_t _Refs
Definition: xlocale:157
void _Init(const _Locinfo &_Lobj)
Definition: locale:87
template<class _Elem>
__CLR_OR_THIS_CALL collate< _Elem >::~collate ( )
inlineprotected
74  { // destroy the object
75  free(_Coll._LocaleName);
76  }
_CRTIMP _CRTNOALIAS void __cdecl free(_Pre_maybenull_ _Post_invalid_ void *_Memory)
_Locinfo::_Collvec _Coll
Definition: locale:129
template<class _Elem>
collate< _Elem >::collate ( const char *  _Locname,
size_t  _Refs = 0 
)
inlineprotected
81  { // construct from specified locale
82  _BEGIN_LOCINFO(_Lobj(_Locname))
83  _Init(_Lobj);
84  _END_LOCINFO()
85  }
Definition: xlocale:102
_Atomic_counter_t _Refs
Definition: xlocale:157
void _Init(const _Locinfo &_Lobj)
Definition: locale:87

Member Function Documentation

template<class _Elem>
static size_t collate< _Elem >::_Getcat ( const locale::facet **  _Ppf = 0,
const locale _Ploc = 0 
)
inlinestatic
65  { // return locale category mask and construct standard facet
66  if (_Ppf != 0 && *_Ppf == 0)
67  *_Ppf = _NEW_CRT collate<_Elem>(
68  _Locinfo(_Ploc->name().c_str()));
69  return (_X_COLLATE);
70  }
#define _NEW_CRT
Definition: xdebug:69
Definition: xlocinfo:54
const _Elem * c_str() const _NOEXCEPT
Definition: xstring:1737
#define _X_COLLATE
Definition: xlocinfo.h:38
string name() const
Definition: xlocale:455
Definition: locale:23
template<class _Elem>
void collate< _Elem >::_Init ( const _Locinfo _Lobj)
inlineprotected
88  { // initialize from _Lobj
89  _Coll = _Lobj._Getcoll();
90  }
_Locinfo::_Collvec _Coll
Definition: locale:129
_Collvec __CLR_OR_THIS_CALL _Getcoll() const
Definition: xlocinfo:110
template<class _Elem>
int collate< _Elem >::compare ( const _Elem *  _First1,
const _Elem *  _Last1,
const _Elem *  _First2,
const _Elem *  _Last2 
) const
inline
33  { // compare [_First1, _Last1) to [_First2, _Last2)
34  return (do_compare(_First1, _Last1, _First2, _Last2));
35  }
virtual int __CLR_OR_THIS_CALL do_compare(const _Elem *_First1, const _Elem *_Last1, const _Elem *_First2, const _Elem *_Last2) const
Definition: locale:92
template<class _Elem>
virtual int __CLR_OR_THIS_CALL collate< _Elem >::do_compare ( const _Elem *  _First1,
const _Elem *  _Last1,
const _Elem *  _First2,
const _Elem *  _Last2 
) const
inlineprotectedvirtual
94  { // compare [_First1, _Last1) to [_First2, _Last2)
95  _DEBUG_RANGE(_First1, _Last1);
96  _DEBUG_RANGE(_First2, _Last2);
97  int _Ans = _LStrcoll(_First1, _Last1, _First2, _Last2, &_Coll);
98  return (_Ans < 0 ? -1 : _Ans == 0 ? 0 : +1);
99  }
#define _DEBUG_RANGE(first, last)
Definition: xutility:467
int __CRTDECL _LStrcoll(const _Elem *_First1, const _Elem *_Last1, const _Elem *_First2, const _Elem *_Last2, const _Locinfo::_Collvec *)
Definition: xlocinfo:238
_Locinfo::_Collvec _Coll
Definition: locale:129
template<class _Elem>
virtual long __CLR_OR_THIS_CALL collate< _Elem >::do_hash ( const _Elem *  _First,
const _Elem *  _Last 
) const
inlineprotectedvirtual
122  { // compute hash code for [_First, _Last)
123  _DEBUG_RANGE(_First, _Last);
124  return ((long)_Hash_seq((const unsigned char *)_First,
125  (_Last - _First) * sizeof (_Elem)));
126  }
#define _DEBUG_RANGE(first, last)
Definition: xutility:467
_STD_BEGIN size_t _Hash_seq(const unsigned char *_First, size_t _Count)
Definition: xstddef:279
_FwdIt _Last
Definition: algorithm:1936
template<class _Elem>
virtual string_type __CLR_OR_THIS_CALL collate< _Elem >::do_transform ( const _Elem *  _First,
const _Elem *  _Last 
) const
inlineprotectedvirtual
103  { // transform [_First, _Last) to key string
104  _DEBUG_RANGE(_First, _Last);
105  size_t _Count;
106  string_type _Str;
107 
108  for (_Count = _Last - _First; 0 < _Count; )
109  { // grow string if locale-specific strxfrm fails
110  _Str.resize(_Count);
111  if ((_Count = _LStrxfrm(&*_Str.begin(),
112  &*_Str.begin() + _Str.size(),
113  _First, _Last, &_Coll)) <= _Str.size())
114  break;
115  }
116  _Str.resize(_Count);
117  return (_Str);
118  }
#define _DEBUG_RANGE(first, last)
Definition: xutility:467
_Locinfo::_Collvec _Coll
Definition: locale:129
basic_string< _Elem, char_traits< _Elem >, allocator< _Elem > > string_type
Definition: locale:29
size_t __CRTDECL _LStrxfrm(_Elem *_First1, _Elem *_Last1, const _Elem *_First2, const _Elem *_Last2, const _Locinfo::_Collvec *)
Definition: xlocinfo:268
_Diff _Count
Definition: algorithm:1941
_FwdIt _Last
Definition: algorithm:1936
template<class _Elem>
long collate< _Elem >::hash ( const _Elem *  _First,
const _Elem *  _Last 
) const
inline
43  { // compute hash code for [_First, _Last)
44  return (do_hash(_First, _Last));
45  }
virtual long __CLR_OR_THIS_CALL do_hash(const _Elem *_First, const _Elem *_Last) const
Definition: locale:120
_FwdIt _Last
Definition: algorithm:1936
template<class _Elem>
string_type collate< _Elem >::transform ( const _Elem *  _First,
const _Elem *  _Last 
) const
inline
38  { // transform [_First, _Last) to key string
39  return (do_transform(_First, _Last));
40  }
virtual string_type __CLR_OR_THIS_CALL do_transform(const _Elem *_First, const _Elem *_Last) const
Definition: locale:101
_FwdIt _Last
Definition: algorithm:1936

Member Data Documentation

template<class _Elem>
_Locinfo::_Collvec collate< _Elem >::_Coll
private
template<class _Elem>
__PURE_APPDOMAIN_GLOBAL locale::id collate< _Elem >::id
static

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