strconv_pcdata_impl< opt_trim, opt_eol, opt_escape > Struct Template Reference

## Static Public Member Functions

static char_t * | parse (char_t *s)

## Detailed Description

### template<typename opt_trim, typename opt_eol, typename opt_escape>
struct strconv_pcdata_impl< opt_trim, opt_eol, opt_escape >

Definition at line 1969 of file pugixml.cpp.

## Member Function Documentation

## parse()

template<typename opt_trim , typename opt_eol , typename opt_escape >

static char_t* strconv_pcdata_impl< opt_trim, opt_eol, opt_escape >::parse | ( | char_t * | s | ) |

inline static

Definition at line 1971 of file pugixml.cpp.

{
gap g;
char_t* begin = s;
while (true)
{
PUGI__SCANWHILE_UNROLL(!PUGI__IS_CHARTYPE(*s, ct_parse_pcdata));
if (*s == '<') // PCDATA ends here
{
char_t* end = g.flush(s);
if (opt_trim::value)
while (end > begin && PUGI__IS_CHARTYPE(end[-1], ct_space))
--end;
*end = 0;
return s + 1;
}
else if (opt_eol::value && *s == '\r') // Either a single 0x0d or 0x0d 0x0a pair
{
*s++ = '\n'; // replace first one with 0x0a
if (*s == '\n') g.push(s, 1);
}
else if (opt_escape::value && *s == '&')
{
s = strconv_escape(s, g);
}
else if (*s == 0)
{
char_t* end = g.flush(s);
if (opt_trim::value)
while (end > begin && PUGI__IS_CHARTYPE(end[-1], ct_space))
--end;
*end = 0;
return s;
}
else ++s;
}
}

References ct_parse_pcdata, ct_space, gap::flush(), PUGI__IS_CHARTYPE, PUGI__SCANWHILE_UNROLL, gap::push(), and strconv_escape().

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

- pugixml.cpp

PUGI__IS_CHARTYPE
#define PUGI__IS_CHARTYPE(c, ct)
Definition: pugixml.cpp:1195
strconv_escape
PUGI__FN char_t * strconv_escape(char_t *s, gap &g)
Definition: pugixml.cpp:1758
ct_space
@ ct_space
Definition: pugixml.cpp:1130
gap::push
void push(char_t *&s, size_t count)
Definition: pugixml.cpp:1727
gap::flush
char_t * flush(char_t *s)
Definition: pugixml.cpp:1744
ct_parse_pcdata
@ ct_parse_pcdata
Definition: pugixml.cpp:1127
PUGI__SCANWHILE_UNROLL
#define PUGI__SCANWHILE_UNROLL(X)
Definition: pugixml.cpp:1906
gap
Definition: pugixml.cpp:1716