| 3349 | }; |
| 3350 | |
| 3351 | PUGI__FN void text_output_escaped(xml_buffered_writer& writer, const char_t* s, chartypex_t type) |
| 3352 | { |
| 3353 | while (*s) |
| 3354 | { |
| 3355 | const char_t* prev = s; |
| 3356 | |
| 3357 | // While *s is a usual symbol |
| 3358 | while (!PUGI__IS_CHARTYPEX(*s, type)) |
| 3359 | ++s; |
| 3360 | |
| 3361 | writer.write(prev, static_cast<size_t>(s - prev)); |
| 3362 | |
| 3363 | switch (*s) |
| 3364 | { |
| 3365 | case 0: break; |
| 3366 | case '&': |
| 3367 | writer.write('&', 'a', 'm', 'p', ';'); |
| 3368 | ++s; |
| 3369 | break; |
| 3370 | case '<': |
| 3371 | writer.write('&', 'l', 't', ';'); |
| 3372 | ++s; |
| 3373 | break; |
| 3374 | case '>': |
| 3375 | writer.write('&', 'g', 't', ';'); |
| 3376 | ++s; |
| 3377 | break; |
| 3378 | case '"': |
| 3379 | writer.write('&', 'q', 'u', 'o', 't', ';'); |
| 3380 | ++s; |
| 3381 | break; |
| 3382 | default: // s is not a usual symbol |
| 3383 | { |
| 3384 | unsigned int ch = static_cast<unsigned int>(*s++); |
| 3385 | assert(ch < 32); |
| 3386 | |
| 3387 | writer.write('&', '#', static_cast<char_t>((ch / 10) + '0'), static_cast<char_t>((ch % 10) + '0'), ';'); |
| 3388 | } |
| 3389 | } |
| 3390 | } |
| 3391 | } |
| 3392 | |
| 3393 | PUGI__FN void text_output(xml_buffered_writer& writer, const char_t* s, chartypex_t type, unsigned int flags) |
| 3394 | { |