37 #define PT_WITH_STD_LOCALE 1
40 #ifdef PT_WITH_STD_LOCALE
51 enum { ok, partial, error, noconv };
54 virtual ~codecvt_base()
58 template <
typename I,
typename E,
typename S>
59 class codecvt :
public std::codecvt_base
62 typedef I intern_type;
63 typedef E extern_type;
67 codecvt(std::size_t ref = 0)
73 codecvt_base::result out(state_type& state,
74 const intern_type* from,
75 const intern_type* from_end,
76 const intern_type*& from_next,
79 extern_type*& to_next)
const
80 {
return this->do_out(state, from, from_end, from_next, to, to_end, to_next); }
82 codecvt_base::result unshift(state_type& state,
85 extern_type*& to_next)
const
86 {
return this->do_unshift(state, to, to_end, to_next); }
88 codecvt_base::result in(state_type& state,
89 const extern_type* from,
90 const extern_type* from_end,
91 const extern_type*& from_next,
94 intern_type*& to_next)
const
95 {
return this->do_in(state, from, from_end, from_next, to, to_end, to_next); }
98 {
return this->do_encoding(); }
100 bool always_noconv()
const
101 {
return this->do_always_noconv(); }
103 int length(state_type& state,
const extern_type* from,
104 const extern_type* end, std::size_t max)
const
105 {
return this->do_length(state, from, end, max); }
107 int max_length()
const
108 {
return this->do_max_length(); }
111 virtual result do_in(state_type& s,
const extern_type* fromBegin,
112 const extern_type* fromEnd,
const extern_type*& fromNext,
113 intern_type* toBegin, intern_type* toEnd, intern_type*& toNext)
const = 0;
115 virtual result do_out(state_type& s,
const intern_type* fromBegin,
116 const intern_type* fromEnd,
const intern_type*& fromNext,
117 extern_type* toBegin, extern_type* toEnd, extern_type*& toNext)
const = 0;
119 virtual bool do_always_noconv()
const = 0;
121 virtual int do_length(state_type& s,
const extern_type* fromBegin,
122 const extern_type* fromEnd, std::size_t max)
const = 0;
124 virtual int do_max_length()
const = 0;
126 virtual std::codecvt_base::result do_unshift(state_type&,
129 extern_type*&)
const = 0;
131 virtual int do_encoding()
const = 0;
147 alnum = alpha | digit,
148 graph = alnum | punct
151 typedef unsigned short mask;
153 ctype_base(std::size_t _refs = 0)