rapidyaml  0.13.0
parse and emit YAML, and do it fast
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

◆ uncatsep()

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 823 of file format.hpp.

824 {
825  if(C4_LIKELY(sep.len > 0))
826  {
827  size_t pos = buf.find(sep);
828  if(C4_LIKELY(pos != csubstr::npos))
829  {
830  if(C4_LIKELY(from_chars(buf.first(pos), &a)))
831  {
832  pos += sep.len;
833  size_t num = uncatsep(buf.sub(pos), sep, more...);
834  if(C4_LIKELY(num != csubstr::npos))
835  return pos + num;
836  }
837  }
838  }
839  return csubstr::npos;
840 }
bool from_chars(csubstr buf, fmt::raw_wrapper r)
read a variable in raw binary format, using memcpy
Definition: format.hpp:469
size_t uncatsep(csubstr buf, csubstr sep, Arg &a, Args &...more)
deserialize the arguments from the given buffer, using a separator.
Definition: format.hpp:823
@ npos
a null string position
Definition: common.hpp:258