STLdoc
STLdocumentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
Public Types | Public Member Functions | Protected Member Functions | List of all members
stdext::cvt::_Cvt_one_byte< _Elem, _Table, _Maxcode > Class Template Reference
Inheritance diagram for stdext::cvt::_Cvt_one_byte< _Elem, _Table, _Maxcode >:

Public Types

typedef _STD codecvt< _Elem, char, _Statype_Mybase
 
typedef _Mybase::result result
 
typedef char _Byte
 
typedef _Elem intern_type
 
typedef _Byte extern_type
 
typedef _Statype state_type
 

Public Member Functions

 _Cvt_one_byte (size_t _Refs=0)
 
virtual ~_Cvt_one_byte () _NOEXCEPT
 

Protected Member Functions

virtual result do_in (_Statype &, const _Byte *_First1, const _Byte *_Last1, const _Byte *&_Mid1, _Elem *_First2, _Elem *_Last2, _Elem *&_Mid2) const
 
virtual result do_out (_Statype &, const _Elem *_First1, const _Elem *_Last1, const _Elem *&_Mid1, _Byte *_First2, _Byte *_Last2, _Byte *&_Mid2) const
 
virtual result do_unshift (_Statype &, _Byte *_First2, _Byte *, _Byte *&_Mid2) const
 
virtual int do_length (_Statype &, const _Byte *_First1, const _Byte *_Last1, size_t _Count) const _THROW0()
 
virtual bool do_always_noconv () const _THROW0()
 
virtual int do_max_length () const _THROW0()
 
virtual int do_encoding () const _THROW0()
 

Member Typedef Documentation

template<class _Elem, class _Table, unsigned long _Maxcode = 0xffff>
typedef char stdext::cvt::_Cvt_one_byte< _Elem, _Table, _Maxcode >::_Byte
template<class _Elem, class _Table, unsigned long _Maxcode = 0xffff>
typedef _STD codecvt<_Elem, char, _Statype> stdext::cvt::_Cvt_one_byte< _Elem, _Table, _Maxcode >::_Mybase
template<class _Elem, class _Table, unsigned long _Maxcode = 0xffff>
typedef _Byte stdext::cvt::_Cvt_one_byte< _Elem, _Table, _Maxcode >::extern_type
template<class _Elem, class _Table, unsigned long _Maxcode = 0xffff>
typedef _Elem stdext::cvt::_Cvt_one_byte< _Elem, _Table, _Maxcode >::intern_type
template<class _Elem, class _Table, unsigned long _Maxcode = 0xffff>
typedef _Mybase::result stdext::cvt::_Cvt_one_byte< _Elem, _Table, _Maxcode >::result
template<class _Elem, class _Table, unsigned long _Maxcode = 0xffff>
typedef _Statype stdext::cvt::_Cvt_one_byte< _Elem, _Table, _Maxcode >::state_type

Constructor & Destructor Documentation

template<class _Elem, class _Table, unsigned long _Maxcode = 0xffff>
stdext::cvt::_Cvt_one_byte< _Elem, _Table, _Maxcode >::_Cvt_one_byte ( size_t  _Refs = 0)
inlineexplicit
36  : _Mybase(_Refs)
37  { // construct with ref count
38  }
_STD codecvt< _Elem, char, _Statype > _Mybase
Definition: xone_byte:28
template<class _Elem, class _Table, unsigned long _Maxcode = 0xffff>
virtual stdext::cvt::_Cvt_one_byte< _Elem, _Table, _Maxcode >::~_Cvt_one_byte ( )
inlinevirtual
41  { // destroy the object
42  }

Member Function Documentation

template<class _Elem, class _Table, unsigned long _Maxcode = 0xffff>
virtual bool stdext::cvt::_Cvt_one_byte< _Elem, _Table, _Maxcode >::do_always_noconv ( ) const
inlineprotectedvirtual
130  { // return true if conversions never change input
131  return (false);
132  }
template<class _Elem, class _Table, unsigned long _Maxcode = 0xffff>
virtual int stdext::cvt::_Cvt_one_byte< _Elem, _Table, _Maxcode >::do_encoding ( ) const
inlineprotectedvirtual
140  { // return length of code sequence (from codecvt)
141  return (1); // >0 => fixed sequence length
142  }
template<class _Elem, class _Table, unsigned long _Maxcode = 0xffff>
virtual result stdext::cvt::_Cvt_one_byte< _Elem, _Table, _Maxcode >::do_in ( _Statype ,
const _Byte _First1,
const _Byte _Last1,
const _Byte *&  _Mid1,
_Elem *  _First2,
_Elem *  _Last2,
_Elem *&  _Mid2 
) const
inlineprotectedvirtual
48  { // convert bytes [_First1, _Last1) to [_First2, _Last)
49  unsigned long _Maxc = _Maxcode; // to quiet warnings
50 
51  _Mid1 = _First1;
52  _Mid2 = _First2;
53  for (; _Mid1 != _Last1 && _Mid2 != _Last2; ++_Mid1)
54  { // get a byte and map it
55  unsigned short _Bytecode = (unsigned char)*_Mid1;
56 
57  if ((_Table::_Nlow <= _Bytecode
58  && (_Bytecode = _Table::_Btw[_Bytecode - _Table::_Nlow]) == 0)
59  || _Maxc < _Bytecode)
60  return (_Mybase::error);
61  *_Mid2++ = (_Elem)_Bytecode;
62  }
63 
64  return (_First1 == _Mid1 ? _Mybase::partial : _Mybase::ok);
65  }
unsigned char
Definition: mbstring.h:107
template<class _Elem, class _Table, unsigned long _Maxcode = 0xffff>
virtual int stdext::cvt::_Cvt_one_byte< _Elem, _Table, _Maxcode >::do_length ( _Statype ,
const _Byte _First1,
const _Byte _Last1,
size_t  _Count 
) const
inlineprotectedvirtual
123  { // return min(_Count, converted length of bytes [_First1, _Last1))
124  size_t _Wchars = _Last1 - _First1;
125 
126  return ((int)(_Wchars < _Count ? _Wchars : _Count));
127  }
_Diff _Count
Definition: algorithm:1941
template<class _Elem, class _Table, unsigned long _Maxcode = 0xffff>
virtual int stdext::cvt::_Cvt_one_byte< _Elem, _Table, _Maxcode >::do_max_length ( ) const
inlineprotectedvirtual
135  { // return maximum length required for a conversion
136  return (1); // length of sequence
137  }
template<class _Elem, class _Table, unsigned long _Maxcode = 0xffff>
virtual result stdext::cvt::_Cvt_one_byte< _Elem, _Table, _Maxcode >::do_out ( _Statype ,
const _Elem *  _First1,
const _Elem *  _Last1,
const _Elem *&  _Mid1,
_Byte _First2,
_Byte _Last2,
_Byte *&  _Mid2 
) const
inlineprotectedvirtual
70  { // convert [_First1, _Last1) to bytes [_First2, _Last)
71  unsigned long _Maxc = _Maxcode; // to quiet warnings
72 
73  _Mid1 = _First1;
74  _Mid2 = _First2;
75  for (; _Mid1 != _Last1 && _Mid2 != _Last2; ++_Mid1)
76  { // get an element and map it
77  unsigned long _Hugecode = (unsigned long)*_Mid1;
78  unsigned short _Widecode = (unsigned short)_Hugecode;
79 
80  if (_Maxc < _Widecode)
81  return (_Mybase::error); // value too large
82  else if (_Widecode < _Table::_Nlow || (_Widecode < 0x100
83  && _Table::_Btw[_Widecode - _Table::_Nlow] == _Widecode))
84  ; // map wide to same byte value
85  else
86  { // search for a valid mapping
87  unsigned long _Lo = 0;
88  unsigned long _Hi = sizeof (_Table::_Wvalid)
89  / sizeof (_Table::_Wvalid[0]);
90 
91  for (; _Lo < _Hi; )
92  { // test midpoint of remaining interval
93  unsigned long _Mid = (_Hi + _Lo) / 2;
94 
95  if (_Widecode < _Table::_Wvalid[_Mid])
96  _Hi = _Mid;
97  else if (_Widecode == _Table::_Wvalid[_Mid])
98  { // found the code, map it
99  _Widecode = _Table::_Wtb[_Mid];
100  break;
101  }
102  else
103  _Lo = _Mid + 1;
104  }
105  if (_Hi <= _Lo)
106  return (_Mybase::error);
107  }
108  *_Mid2++ = (_Byte)_Widecode;
109  }
110 
111  return (_First1 == _Mid1 ? _Mybase::partial : _Mybase::ok);
112  }
_In_ long
Definition: corecrt_wstdlib.h:88
char _Byte
Definition: xone_byte:30
template<class _Elem, class _Table, unsigned long _Maxcode = 0xffff>
virtual result stdext::cvt::_Cvt_one_byte< _Elem, _Table, _Maxcode >::do_unshift ( _Statype ,
_Byte _First2,
_Byte ,
_Byte *&  _Mid2 
) const
inlineprotectedvirtual
116  { // generate bytes to return to default shift state
117  _Mid2 = _First2;
118  return (_Mybase::ok);
119  }

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