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

Public Types

typedef make_unsigned< _Elem >::type _Uelem
 
typedef _Regex_traits< _Elem > _Myt
 
typedef _Elem char_type
 
typedef size_t size_type
 
typedef basic_string< _Elem > string_type
 
typedef locale locale_type
 
- Public Types inherited from _Regex_traits_base
enum  _Char_class_type {
  _Ch_none = 0, _Ch_alnum = ctype_base::alnum, _Ch_alpha = ctype_base::alpha, _Ch_cntrl = ctype_base::cntrl,
  _Ch_digit = ctype_base::digit, _Ch_graph = ctype_base::graph, _Ch_lower = ctype_base::lower, _Ch_print = ctype_base::print,
  _Ch_punct = ctype_base::punct, _Ch_space = ctype_base::space, _Ch_upper = ctype_base::upper, _Ch_xdigit = ctype_base::xdigit,
  _Ch_blank = ctype_base::blank
}
 
typedef ctype_base::mask char_class_type
 

Public Member Functions

 _Regex_traits ()
 
 _Regex_traits (const _Myt &_Right)
 
_Mytoperator= (const _Myt &_Right)
 
_Elem translate (_Elem _Ch) const
 
_Elem translate_nocase (_Elem _Ch) const
 
template<class _FwdIt >
string_type transform (_FwdIt _First, _FwdIt _Last) const
 
template<class _FwdIt >
string_type transform_primary (_FwdIt _First, _FwdIt _Last) const
 
bool isctype (_Elem _Ch, char_class_type _Fx) const
 
template<class _Iter >
char_class_type lookup_classname (_Iter _First, _Iter _Last, bool _Icase=false) const
 
template<class _FwdIt >
string_type lookup_collatename (_FwdIt _First, _FwdIt _Last) const
 
locale_type imbue (locale_type _Lx)
 
locale_type getloc () const
 
const collate< _Elem > * _Getcoll () const
 
const ctype< _Elem > * _Getctype () const
 

Static Public Member Functions

static size_type length (const _Elem *_Str)
 

Private Member Functions

void _Cache_locale ()
 

Private Attributes

const collate< _Elem > * _Pcoll
 
const ctype< _Elem > * _Pctype
 
locale_type _Loc
 

Member Typedef Documentation

template<class _Elem>
typedef _Regex_traits<_Elem> _Regex_traits< _Elem >::_Myt
template<class _Elem>
typedef make_unsigned<_Elem>::type _Regex_traits< _Elem >::_Uelem
template<class _Elem>
typedef _Elem _Regex_traits< _Elem >::char_type
template<class _Elem>
typedef locale _Regex_traits< _Elem >::locale_type
template<class _Elem>
typedef size_t _Regex_traits< _Elem >::size_type
template<class _Elem>
typedef basic_string<_Elem> _Regex_traits< _Elem >::string_type

Constructor & Destructor Documentation

template<class _Elem>
_Regex_traits< _Elem >::_Regex_traits ( )
inline
277  { // default construct
278  _Cache_locale();
279  }
void _Cache_locale()
Definition: regex:411
template<class _Elem>
_Regex_traits< _Elem >::_Regex_traits ( const _Myt _Right)
inline
282  : _Loc(_Right._Loc)
283  { // copy construct
284  _Cache_locale();
285  }
locale_type _Loc
Definition: regex:419
void _Cache_locale()
Definition: regex:411
constexpr const _Ty &() _Right
Definition: algorithm:3591

Member Function Documentation

template<class _Elem>
void _Regex_traits< _Elem >::_Cache_locale ( )
inlineprivate
412  { // populate _Pcoll and _Pctype with _Loc locale
415  }
const collate< _Elem > * _Pcoll
Definition: regex:417
const ctype< _Elem > * _Pctype
Definition: regex:418
#define _USE(loc, fac)
Definition: xlocale:547
Definition: xlocale:2115
locale_type _Loc
Definition: regex:419
Definition: locale:23
template<class _Elem>
const collate<_Elem>* _Regex_traits< _Elem >::_Getcoll ( ) const
inline
401  { // get collate facet pointer
402  return (_Pcoll);
403  }
const collate< _Elem > * _Pcoll
Definition: regex:417
template<class _Elem>
const ctype<_Elem>* _Regex_traits< _Elem >::_Getctype ( ) const
inline
406  { // get ctype facet pointer
407  return (_Pctype);
408  }
const ctype< _Elem > * _Pctype
Definition: regex:418
template<class _Elem>
locale_type _Regex_traits< _Elem >::getloc ( ) const
inline
396  { // return locale object
397  return (_Loc);
398  }
locale_type _Loc
Definition: regex:419
template<class _Elem>
locale_type _Regex_traits< _Elem >::imbue ( locale_type  _Lx)
inline
388  { // store locale object
389  locale_type _Tmp = _Loc;
390  _Loc = _Lx;
391  _Cache_locale();
392  return (_Tmp);
393  }
locale_type _Loc
Definition: regex:419
void _Cache_locale()
Definition: regex:411
locale locale_type
Definition: regex:269
template<class _Elem>
bool _Regex_traits< _Elem >::isctype ( _Elem  _Ch,
char_class_type  _Fx 
) const
inline
329  { // return true if _Ch is in character class _Fx
330  if (_Fx != (char_class_type)(-1))
331  return (_Getctype()->is(_Fx, _Ch));
332  else
333  return (_Ch == '_' // assumes L'_' == '_'
334  || _Getctype()->is(_Ch_alnum, _Ch));
335  }
const ctype< _Elem > * _Getctype() const
Definition: regex:405
Definition: regex:243
_Check_return_ _In_ wchar_t _Ch
Definition: vcruntime_string.h:89
ctype_base::mask char_class_type
Definition: regex:256
template<class _Elem>
static size_type _Regex_traits< _Elem >::length ( const _Elem *  _Str)
inlinestatic
272  { // return length of _Str
273  return (char_traits<_Elem>::length(_Str));
274  }
Definition: iosfwd:260
template<class _Elem>
template<class _Iter >
char_class_type _Regex_traits< _Elem >::lookup_classname ( _Iter  _First,
_Iter  _Last,
bool  _Icase = false 
) const
inline
340  { // map [_First, _Last) to character class mask value
341  #define _REGEX_CHAR_CLASS_NAME(n, c) \
342  {n, L ## n, sizeof (n) / sizeof (n[0]) - 1, c}
343  static const _Cl_names _Names[] = // TRANSITION, VSO#202551
344  { // map class names to numeric constants
360  {0, 0, 0},
361  };
362  #undef _REGEX_CHAR_CLASS_NAME
363 
364  _DEBUG_RANGE(_First, _Last);
365  unsigned int _Ix = 0;
366  for (; _Names[_Ix]._Get<_Elem>(); ++_Ix)
367  if (_STD equal(_First, _Last,
368  _Names[_Ix]._Get<_Elem>(),
369  _Names[_Ix]._Get<_Elem>() + _Names[_Ix]._Len,
371  break;
372 
373  char_class_type _Mask = (char_class_type)0;
374  if (_Names[_Ix]._Get<_Elem>() != 0)
375  _Mask = _Names[_Ix]._Ctype;
376  if (_Icase && _Mask & (_Ch_lower | _Ch_upper))
377  _Mask |= _Ch_lower | _Ch_upper;
378  return (_Mask);
379  }
Definition: regex:197
Definition: regex:250
Definition: regex:252
#define _DEBUG_RANGE(first, last)
Definition: xutility:822
Definition: regex:245
Definition: regex:163
Definition: regex:260
Definition: regex:243
Definition: regex:244
Definition: regex:253
#define _REGEX_CHAR_CLASS_NAME(n, c)
Definition: regex:249
short mask
Definition: xlocale:2099
ctype_base::mask char_class_type
Definition: regex:256
const _Elem * _Get() const
Definition: regex:254
bool equal(_InIt1 _First1, _InIt1 _Last1, _InIt2 _First2)
Definition: memory:611
Definition: regex:248
Definition: regex:246
Definition: regex:251
Definition: regex:247
_FwdIt _Last
Definition: algorithm:1936
template<class _Elem>
template<class _FwdIt >
string_type _Regex_traits< _Elem >::lookup_collatename ( _FwdIt  _First,
_FwdIt  _Last 
) const
inline
383  { // map [_First, _Last) to collation element
384  return (string_type(_First, _Last));
385  }
basic_string< _Elem > string_type
Definition: regex:268
_FwdIt _Last
Definition: algorithm:1936
template<class _Elem>
_Myt& _Regex_traits< _Elem >::operator= ( const _Myt _Right)
inline
288  { // assign
289  _Loc = _Right._Loc;
290  _Cache_locale();
291  return (*this);
292  }
locale_type _Loc
Definition: regex:419
void _Cache_locale()
Definition: regex:411
constexpr const _Ty &() _Right
Definition: algorithm:3591
template<class _Elem>
template<class _FwdIt >
string_type _Regex_traits< _Elem >::transform ( _FwdIt  _First,
_FwdIt  _Last 
) const
inline
307  { // apply locale-specific transformation
308  return (_Getcoll()->transform(_First, _Last));
309  }
const collate< _Elem > * _Getcoll() const
Definition: regex:400
string_type transform(_FwdIt _First, _FwdIt _Last) const
Definition: regex:306
_FwdIt _Last
Definition: algorithm:1936
template<class _Elem>
template<class _FwdIt >
string_type _Regex_traits< _Elem >::transform_primary ( _FwdIt  _First,
_FwdIt  _Last 
) const
inline
313  { // apply locale-specific case-insensitive transformation
314  string_type _Res;
315 
316  if (_First != _Last)
317  { // non-empty string, transform it
318  vector<_Elem> _Temp(_First, _Last);
319 
320  _Getctype()->tolower(&*_Temp.begin(),
321  &*_Temp.begin() + _Temp.size());
322  _Res = _Getcoll()->transform(&*_Temp.begin(),
323  &*_Temp.begin() + _Temp.size());
324  }
325  return (_Res);
326  }
const ctype< _Elem > * _Getctype() const
Definition: regex:405
const collate< _Elem > * _Getcoll() const
Definition: regex:400
Definition: vector:678
basic_string< _Elem > string_type
Definition: regex:268
_FwdIt _Last
Definition: algorithm:1936
template<class _Elem>
_Elem _Regex_traits< _Elem >::translate ( _Elem  _Ch) const
inline
295  { // provide locale-sensitive mapping
296  string_type _Res = _Getcoll()->transform(&_Ch, &_Ch + 1);
297  return (_Res.length() == 1 ? _Res[0] : _Ch);
298  }
const collate< _Elem > * _Getcoll() const
Definition: regex:400
_Check_return_ _In_ wchar_t _Ch
Definition: vcruntime_string.h:89
basic_string< _Elem > string_type
Definition: regex:268
template<class _Elem>
_Elem _Regex_traits< _Elem >::translate_nocase ( _Elem  _Ch) const
inline
301  { // provide case-insensitive mapping
302  return (_Getctype()->tolower(_Ch));
303  }
const ctype< _Elem > * _Getctype() const
Definition: regex:405
_Check_return_ _In_ wchar_t _Ch
Definition: vcruntime_string.h:89
_Elem() tolower(_Elem _Ch, const locale &_Loc)
Definition: locale:258

Member Data Documentation

template<class _Elem>
locale_type _Regex_traits< _Elem >::_Loc
private
template<class _Elem>
const collate<_Elem>* _Regex_traits< _Elem >::_Pcoll
private
template<class _Elem>
const ctype<_Elem>* _Regex_traits< _Elem >::_Pctype
private

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