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
35  : _Mybase(_Refs)
36  { // construct with ref count
37  }
_STD codecvt< _Elem, char, _Statype > _Mybase
Definition: xone_byte:27
template<class _Elem, class _Table, unsigned long _Maxcode = 0xffff>
virtual stdext::cvt::_Cvt_one_byte< _Elem, _Table, _Maxcode >::~_Cvt_one_byte ( )
inlinevirtual
40  { // destroy the object
41  }

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

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