Static Public Member Functions | List of all members
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)
inlinestatic

Definition at line 1971 of file pugixml.cpp.

1972  {
1973  gap g;
1974 
1975  char_t* begin = s;
1976 
1977  while (true)
1978  {
1980 
1981  if (*s == '<') // PCDATA ends here
1982  {
1983  char_t* end = g.flush(s);
1984 
1985  if (opt_trim::value)
1986  while (end > begin && PUGI__IS_CHARTYPE(end[-1], ct_space))
1987  --end;
1988 
1989  *end = 0;
1990 
1991  return s + 1;
1992  }
1993  else if (opt_eol::value && *s == '\r') // Either a single 0x0d or 0x0d 0x0a pair
1994  {
1995  *s++ = '\n'; // replace first one with 0x0a
1996 
1997  if (*s == '\n') g.push(s, 1);
1998  }
1999  else if (opt_escape::value && *s == '&')
2000  {
2001  s = strconv_escape(s, g);
2002  }
2003  else if (*s == 0)
2004  {
2005  char_t* end = g.flush(s);
2006 
2007  if (opt_trim::value)
2008  while (end > begin && PUGI__IS_CHARTYPE(end[-1], ct_space))
2009  --end;
2010 
2011  *end = 0;
2012 
2013  return s;
2014  }
2015  else ++s;
2016  }
2017  }

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:
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

Generated on Wed Apr 29 2020 19:41:30 for QuickFIX by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2001