rapidyaml  0.16.0
parseandemitYAML,anddoitfast
uncatsep: deserialize the separated arguments from a string

Functions

template<class Arg , class... Args>
size_t c4::uncatsep (csubstr buf, csubstr sep, Arg &a, Args &...more)
 deserialize the arguments from the given buffer, using a separator. More...
 

Detailed Description

Function Documentation

template<class Arg , class... Args>
size_t c4::uncatsep ( csubstr  buf,
csubstr  sep,
Arg &  a,
Args &...  more 
)

deserialize the arguments from the given buffer, using a separator.

Returns
the number of characters read from the buffer, or csubstr::npos if a conversion was not successful
See also
c4::catsep(). c4::uncatsep() is the inverse of c4::catsep().

Definition at line 819 of file format.hpp.

Referenced by sample_formatting().

820 {
821  if C4_LIKELY(sep.len > 0)
822  {
823  size_t pos = buf.find(sep);
824  if C4_LIKELY(pos != csubstr::npos)
825  {
826  if C4_LIKELY(from_chars(buf.first(pos), &a))
827  {
828  pos += sep.len;
829  size_t num = uncatsep(buf.sub(pos), sep, more...);
830  if C4_LIKELY(num != csubstr::npos)
831  return pos + num;
832  }
833  }
834  }
835  return csubstr::npos;
836 }
size_t uncatsep(csubstr buf, csubstr sep, Arg &a, Args &...more)
deserialize the arguments from the given buffer, using a separator.
Definition: format.hpp:819
bool from_chars(csubstr buf, fmt::raw_wrapper r)
read a variable in raw binary format, using memcpy
Definition: format.hpp:465
a null string position
Definition: common.hpp:138
basic_substring< const char > csubstr
an immutable string view
Definition: substr.hpp:2356