37 #define PT_WITH_STD_LOCALE 1
40 #ifdef PT_WITH_STD_LOCALE
49 enum { ok, partial, error, noconv };
52 virtual ~codecvt_base()
56 template <
typename I,
typename E,
typename S>
57 class codecvt :
public std::codecvt_base
60 typedef I intern_type;
61 typedef E extern_type;
65 codecvt(std::size_t ref = 0)
71 codecvt_base::result out(state_type& state,
72 const intern_type* from,
73 const intern_type* from_end,
74 const intern_type*& from_next,
77 extern_type*& to_next)
const
78 {
return this->do_out(state, from, from_end, from_next, to, to_end, to_next); }
80 codecvt_base::result unshift(state_type& state,
83 extern_type*& to_next)
const
84 {
return this->do_unshift(state, to, to_end, to_next); }
86 codecvt_base::result in(state_type& state,
87 const extern_type* from,
88 const extern_type* from_end,
89 const extern_type*& from_next,
92 intern_type*& to_next)
const
93 {
return this->do_in(state, from, from_end, from_next, to, to_end, to_next); }
96 {
return this->do_encoding(); }
98 bool always_noconv()
const
99 {
return this->do_always_noconv(); }
101 int length(state_type& state,
const extern_type* from,
102 const extern_type* end, std::size_t max)
const
103 {
return this->do_length(state, from, end, max); }
105 int max_length()
const
106 {
return this->do_max_length(); }
109 virtual result do_in(state_type& s,
const extern_type* fromBegin,
110 const extern_type* fromEnd,
const extern_type*& fromNext,
111 intern_type* toBegin, intern_type* toEnd, intern_type*& toNext)
const = 0;
113 virtual result do_out(state_type& s,
const intern_type* fromBegin,
114 const intern_type* fromEnd,
const intern_type*& fromNext,
115 extern_type* toBegin, extern_type* toEnd, extern_type*& toNext)
const = 0;
117 virtual bool do_always_noconv()
const = 0;
119 virtual int do_length(state_type& s,
const extern_type* fromBegin,
120 const extern_type* fromEnd, std::size_t max)
const = 0;
122 virtual int do_max_length()
const = 0;
124 virtual std::codecvt_base::result do_unshift(state_type&,
127 extern_type*&)
const = 0;
129 virtual int do_encoding()
const = 0;
145 alnum = alpha | digit,
146 graph = alnum | punct
149 typedef unsigned short mask;
151 ctype_base(std::size_t _refs = 0)