ReactOS 0.4.15-dev-7907-g95bf896
generator_codecvt Struct Reference
Inheritance diagram for generator_codecvt:
Collaboration diagram for generator_codecvt:

Public Types

typedef codecvt< char, char, mbstate_tbase
 
- Public Types inherited from codecvt< char, char, mbstate_t >
typedef char intern_type
 
typedef char extern_type
 
typedef mbstate_t state_type
 
- Public Types inherited from codecvt_base
enum  result { ok , partial , error , noconv }
 

Public Member Functions

 generator_codecvt (size_t refs=0)
 
virtual base::result do_in (mbstate_t &mb, const char *ebegin, const char *eend, const char *&ecur, char *ibegin, char *iend, char *&icur) const __NO_THROW
 
virtual bool do_always_noconv () const __NO_THROW
 
virtual int do_encoding () const __NO_THROW
 
virtual int do_length (mbstate_t &mb, const char *efrom, const char *eend, size_t m) const
 
virtual int do_max_length () const __NO_THROW
 
- Public Member Functions inherited from codecvt< char, char, mbstate_t >
 codecvt (size_t __refs=0)
 
result out (state_type &__state, const char *__from, const char *__from_end, const char *&__from_next, char *__to, char *__to_limit, char *&__to_next) const
 
result unshift (state_type &__state, char *__to, char *__to_limit, char *&__to_next) const
 
result in (state_type &__state, const char *__from, const char *__from_end, const char *&__from_next, char *__to, char *__to_limit, char *&__to_next) const
 
int encoding () const _STLP_NOTHROW
 
bool always_noconv () const _STLP_NOTHROW
 
int length (state_type &__state, const char *__from, const char *__from_end, size_t __max) const
 
int max_length () const _STLP_NOTHROW
 

Additional Inherited Members

- Static Public Attributes inherited from codecvt< char, char, mbstate_t >
static _STLP_STATIC_DECLSPEC locale::id id = { 3 }
 
- Protected Member Functions inherited from codecvt< char, char, mbstate_t >
 ~codecvt ()
 
virtual result do_out (state_type &, const char *__from, const char *, const char *&__from_next, char *__to, char *, char *&__to_next) const
 
virtual result do_in (state_type &, const char *__from, const char *, const char *&__from_next, char *__to, char *, char *&__to_next) const
 
virtual result do_unshift (state_type &, char *__to, char *, char *&__to_next) const
 
virtual int do_encoding () const _STLP_NOTHROW
 
virtual bool do_always_noconv () const _STLP_NOTHROW
 
virtual int do_length (state_type &__state, const char *__from, const char *__end, size_t __max) const
 
virtual int do_max_length () const _STLP_NOTHROW
 
- Protected Member Functions inherited from locale::facet
 facet (size_t __init_count=0)
 
virtual ~facet ()
 
- Protected Member Functions inherited from _Refcount_Base
 _Refcount_Base (__stl_atomic_t __n)
 
__stl_atomic_t _M_incr ()
 
__stl_atomic_t _M_decr ()
 

Detailed Description

Definition at line 148 of file codecvt_test.cpp.

Member Typedef Documentation

◆ base

Definition at line 149 of file codecvt_test.cpp.

Constructor & Destructor Documentation

◆ generator_codecvt()

generator_codecvt::generator_codecvt ( size_t  refs = 0)
inlineexplicit

Definition at line 151 of file codecvt_test.cpp.

151: base(refs) {}
codecvt< char, char, mbstate_t > base

Member Function Documentation

◆ do_always_noconv()

virtual bool generator_codecvt::do_always_noconv ( ) const
inlinevirtual

Reimplemented from codecvt< char, char, mbstate_t >.

Definition at line 228 of file codecvt_test.cpp.

229 { return false; }

◆ do_encoding()

virtual int generator_codecvt::do_encoding ( ) const
inlinevirtual

Reimplemented from codecvt< char, char, mbstate_t >.

Definition at line 232 of file codecvt_test.cpp.

233 { return 0; }

◆ do_in()

virtual base::result generator_codecvt::do_in ( mbstate_t mb,
const char ebegin,
const char eend,
const char *&  ecur,
char ibegin,
char iend,
char *&  icur 
) const
inlinevirtual

Reimplemented from codecvt< char, char, mbstate_t >.

Definition at line 155 of file codecvt_test.cpp.

157 {
158 //Access the mbstate information in a portable way:
159 char *state = (char*)&mb;
160 ecur = ebegin;
161 icur = ibegin;
162
163 if (icur == iend) return ok;
164
165 if (*state == 2) {
166 *(icur++) = 'b';
167 if (icur == iend) {
168 *state = 3;
169 return ok;
170 }
171 *(icur++) = 'c';
172 *state = 0;
173 }
174 else if (*state == 3) {
175 *(icur++) = 'c';
176 *state = 0;
177 }
178
179 while (ecur != eend) {
180 if (icur == iend)
181 return ok;
182 if (*ecur == '0' || *state == 1) {
183 if (*state != 1) {
184 ++ecur;
185 }
186 if (ecur == eend) {
187 *state = 1;
188 return partial;
189 }
190
191 if (*ecur == '1') {
192 *(icur++) = 'a';
193 if (icur == iend) {
194 *state = 2;
195 return ok;
196 }
197 *(icur++) = 'b';
198 if (icur == iend) {
199 *state = 3;
200 return ok;
201 }
202 *icur = 'c';
203 }
204 else {
205 *(icur++) = '0';
206 if (icur == iend) {
207 if (*state != 1) {
208 --ecur;
209 }
210 return ok;
211 }
212 *icur = *ecur;
213 }
214 }
215 else {
216 *icur = *ecur;
217 }
218
219 *state = 0;
220 ++icur;
221 ++ecur;
222 }
223
224 return ok;
225 }
static int state
Definition: maze.c:121

Referenced by do_length().

◆ do_length()

virtual int generator_codecvt::do_length ( mbstate_t mb,
const char efrom,
const char eend,
size_t  m 
) const
inlinevirtual

Reimplemented from codecvt< char, char, mbstate_t >.

Definition at line 236 of file codecvt_test.cpp.

237 {
238 const char *state = (const char*)&mb;
239 int offset = 0;
240 if (*state == 2)
241 offset = 2;
242 else if (*state == 3)
243 offset = 1;
244
245 char *ibegin = new char[m + offset];
246 const char *ecur = efrom;
247 char *icur = ibegin;
248 mbstate_t tmpState = mb;
249 do_in(tmpState, efrom, eend, ecur, ibegin, ibegin + m + offset, icur);
250 /*
251 char *state = (char*)&tmpState;
252 if (*state != 0) {
253 if (*state == 1)
254 --ecur;
255 else if (*state == 2 || *state == 3) {
256 //Undefined position, we return -1:
257 ecur = efrom - 1;
258 }
259 }
260 else {
261 if (*((char*)&mb) != 0) {
262 //We take into account the character that hasn't been counted yet in
263 //the previous decoding step:
264 ecur++;
265 }
266 }
267 */
268 delete[] ibegin;
269 return (int)min((size_t)(ecur - efrom), m);
270 }
GLintptr offset
Definition: glext.h:5920
const GLfloat * m
Definition: glext.h:10848
#define min(a, b)
Definition: monoChain.cc:55
virtual base::result do_in(mbstate_t &mb, const char *ebegin, const char *eend, const char *&ecur, char *ibegin, char *iend, char *&icur) const __NO_THROW

◆ do_max_length()

virtual int generator_codecvt::do_max_length ( ) const
inlinevirtual

Reimplemented from codecvt< char, char, mbstate_t >.

Definition at line 272 of file codecvt_test.cpp.

273 { return 0; }

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