rapidyaml  0.11.0
parse and emit YAML, and do it fast
c4 Namespace Reference

(Undefined by default) Use shorter error message from checks/asserts: do not show the check condition in the error message. More...

Namespaces

 fmt
 
 yml
 

Classes

struct  basic_substring
 a non-owning string-view, consisting of a character pointer and a length. More...
 
struct  is_string
 a traits class to mark a type as a string type (meaning c4::to_csubstr() can be used directly). More...
 
struct  is_writeable_string
 a traits class to mark a type as a writeable string type (meaning c4::to_substr() can be used directly). More...
 
struct  is_string< basic_substring< C > >
 
struct  is_writeable_string< basic_substring< char > >
 
struct  is_writeable_string< basic_substring< const char > >
 
struct  is_string< const char * >
 
struct  is_writeable_string< const char * >
 
struct  is_string< char * >
 
struct  is_writeable_string< char * >
 
struct  is_string< const char(&)[N]>
 
struct  is_writeable_string< const char(&)[N]>
 
struct  is_string< char(&)[N]>
 
struct  is_writeable_string< char(&)[N]>
 
struct  is_string< const char[N]>
 
struct  is_writeable_string< const char[N]>
 
struct  is_string< char[N]>
 
struct  is_writeable_string< char[N]>
 
struct  is_string< std::string >
 
struct  is_writeable_string< std::string >
 
struct  is_string< std::string_view >
 
struct  is_string< std::vector< char, Alloc > >
 
struct  is_writeable_string< std::vector< char, Alloc > >
 

Enumerations

enum  RealFormat_e : char { FTOA_FLOAT = 'f' , FTOA_SCIENT = 'e' , FTOA_FLEX = 'g' , FTOA_HEXA = 'a' }
 

Functions

template<>
c4::EnumSymbols< yml::extra::ievt::EventFlagsesyms< yml::extra::ievt::EventFlags > ()
 
substr to_substr (substr s) noexcept
 neutral version for use in generic code More...
 
csubstr to_csubstr (substr s) noexcept
 neutral version for use in generic code More...
 
csubstr to_csubstr (csubstr s) noexcept
 neutral version for use in generic code More...
 
template<size_t N>
substr to_substr (char(&s)[N]) noexcept
 
template<size_t N>
csubstr to_csubstr (const char(&s)[N]) noexcept
 
template<class U >
auto to_substr (U s) noexcept -> typename std::enable_if< std::is_same< U, char * >::value, substr >::type
 
template<class U >
auto to_csubstr (U s) noexcept -> typename std::enable_if< std::is_same< U, const char * >::value||std::is_same< U, char * >::value, csubstr >::type
 
template<typename C , size_t N>
bool operator== (const char(&s)[N], basic_substring< C > const that) noexcept
 
template<typename C , size_t N>
bool operator!= (const char(&s)[N], basic_substring< C > const that) noexcept
 
template<typename C , size_t N>
bool operator< (const char(&s)[N], basic_substring< C > const that) noexcept
 
template<typename C , size_t N>
bool operator> (const char(&s)[N], basic_substring< C > const that) noexcept
 
template<typename C , size_t N>
bool operator<= (const char(&s)[N], basic_substring< C > const that) noexcept
 
template<typename C , size_t N>
bool operator>= (const char(&s)[N], basic_substring< C > const that) noexcept
 
template<typename C >
bool operator== (const char c, basic_substring< C > const that) noexcept
 
template<typename C >
bool operator!= (const char c, basic_substring< C > const that) noexcept
 
template<typename C >
bool operator< (const char c, basic_substring< C > const that) noexcept
 
template<typename C >
bool operator> (const char c, basic_substring< C > const that) noexcept
 
template<typename C >
bool operator<= (const char c, basic_substring< C > const that) noexcept
 
template<typename C >
bool operator>= (const char c, basic_substring< C > const that) noexcept
 
template<class OStream , class C >
OStream & operator<< (OStream &os, basic_substring< C > s)
 output the string to a stream More...
 
template<class T >
auto digits_dec (T v) noexcept -> typename std::enable_if< sizeof(T)==1u, unsigned >::type
 decimal digits for 8 bit integers More...
 
template<class T >
unsigned digits_hex (T v) noexcept
 return the number of digits required to encode an hexadecimal number. More...
 
template<class T >
unsigned digits_bin (T v) noexcept
 return the number of digits required to encode a binary number. More...
 
template<class T >
unsigned digits_oct (T v_) noexcept
 return the number of digits required to encode an octal number. More...
 
template<class T >
void write_dec_unchecked (substr buf, T v, unsigned digits_v) noexcept
 
template<class T >
void write_hex_unchecked (substr buf, T v, unsigned digits_v) noexcept
 
template<class T >
void write_oct_unchecked (substr buf, T v, unsigned digits_v) noexcept
 
template<class T >
void write_bin_unchecked (substr buf, T v, unsigned digits_v) noexcept
 
template<class T >
size_t write_dec (substr buf, T v) noexcept
 write an integer to a string in decimal format. More...
 
template<class T >
size_t write_hex (substr buf, T v) noexcept
 write an integer to a string in hexadecimal format. More...
 
template<class T >
size_t write_oct (substr buf, T v) noexcept
 write an integer to a string in octal format. More...
 
template<class T >
size_t write_bin (substr buf, T v) noexcept
 write an integer to a string in binary format. More...
 
template<class T >
size_t write_dec (substr buf, T val, size_t num_digits) noexcept
 same as c4::write_dec(), but pad with zeroes on the left such that the resulting string is num_digits wide. More...
 
template<class T >
size_t write_hex (substr buf, T val, size_t num_digits) noexcept
 same as c4::write_hex(), but pad with zeroes on the left such that the resulting string is num_digits wide. More...
 
template<class T >
size_t write_bin (substr buf, T val, size_t num_digits) noexcept
 same as c4::write_bin(), but pad with zeroes on the left such that the resulting string is num_digits wide. More...
 
template<class T >
size_t write_oct (substr buf, T val, size_t num_digits) noexcept
 same as c4::write_oct(), but pad with zeroes on the left such that the resulting string is num_digits wide. More...
 
template<class I >
bool read_dec (csubstr s, I *v) noexcept
 read a decimal integer from a string. More...
 
template<class I >
bool read_hex (csubstr s, I *v) noexcept
 read an hexadecimal integer from a string. More...
 
template<class I >
bool read_bin (csubstr s, I *v) noexcept
 read a binary integer from a string. More...
 
template<class I >
bool read_oct (csubstr s, I *v) noexcept
 read an octal integer from a string. More...
 
template<class T >
size_t itoa (substr buf, T v) noexcept
 convert an integral signed decimal to a string. More...
 
template<class T >
size_t itoa (substr buf, T v, T radix) noexcept
 convert an integral signed integer to a string, using a specific radix. More...
 
template<class T >
size_t itoa (substr buf, T v, T radix, size_t num_digits) noexcept
 same as c4::itoa(), but pad with zeroes on the left such that the resulting string is num_digits wide, not accounting for radix prefix (0x,0o,0b). More...
 
template<class T >
size_t utoa (substr buf, T v) noexcept
 convert an integral unsigned decimal to a string. More...
 
template<class T >
size_t utoa (substr buf, T v, T radix) noexcept
 convert an integral unsigned integer to a string, using a specific radix. More...
 
template<class T >
size_t utoa (substr buf, T v, T radix, size_t num_digits) noexcept
 same as c4::utoa(), but pad with zeroes on the left such that the resulting string is num_digits wide. More...
 
template<class T >
bool atoi (csubstr str, T *v) noexcept
 Convert a trimmed string to a signed integral value. More...
 
template<class T >
size_t atoi_first (csubstr str, T *v)
 Select the next range of characters in the string that can be parsed as a signed integral value, and convert it using atoi(). More...
 
template<class T >
bool atou (csubstr str, T *v) noexcept
 Convert a trimmed string to an unsigned integral value. More...
 
template<class T >
size_t atou_first (csubstr str, T *v)
 Select the next range of characters in the string that can be parsed as an unsigned integral value, and convert it using atou(). More...
 
template<class T >
auto overflows (csubstr str) noexcept -> typename std::enable_if< std::is_unsigned< T >::value, bool >::type
 Test if the following string would overflow when converted to associated integral types; this function is dispatched with SFINAE to handle differently signed and unsigned types. More...
 
size_t ftoa (substr str, float v, int precision=-1, RealFormat_e formatting=FTOA_FLEX) noexcept
 Convert a single-precision real number to string. More...
 
size_t dtoa (substr str, double v, int precision=-1, RealFormat_e formatting=FTOA_FLEX) noexcept
 Convert a double-precision real number to string. More...
 
bool atof (csubstr str, float *v) noexcept
 Convert a string to a single precision real number. More...
 
size_t atof_first (csubstr str, float *v) noexcept
 Convert a string to a single precision real number. More...
 
bool atod (csubstr str, double *v) noexcept
 Convert a string to a double precision real number. More...
 
size_t atod_first (csubstr str, double *v) noexcept
 Convert a string to a double precision real number. More...
 
size_t xtoa (substr s, uint8_t v) noexcept
 
size_t xtoa (substr s, uint16_t v) noexcept
 
size_t xtoa (substr s, uint32_t v) noexcept
 
size_t xtoa (substr s, uint64_t v) noexcept
 
size_t xtoa (substr s, int8_t v) noexcept
 
size_t xtoa (substr s, int16_t v) noexcept
 
size_t xtoa (substr s, int32_t v) noexcept
 
size_t xtoa (substr s, int64_t v) noexcept
 
size_t xtoa (substr s, float v) noexcept
 
size_t xtoa (substr s, double v) noexcept
 
size_t xtoa (substr s, uint8_t v, uint8_t radix) noexcept
 
size_t xtoa (substr s, uint16_t v, uint16_t radix) noexcept
 
size_t xtoa (substr s, uint32_t v, uint32_t radix) noexcept
 
size_t xtoa (substr s, uint64_t v, uint64_t radix) noexcept
 
size_t xtoa (substr s, int8_t v, int8_t radix) noexcept
 
size_t xtoa (substr s, int16_t v, int16_t radix) noexcept
 
size_t xtoa (substr s, int32_t v, int32_t radix) noexcept
 
size_t xtoa (substr s, int64_t v, int64_t radix) noexcept
 
size_t xtoa (substr s, uint8_t v, uint8_t radix, size_t num_digits) noexcept
 
size_t xtoa (substr s, uint16_t v, uint16_t radix, size_t num_digits) noexcept
 
size_t xtoa (substr s, uint32_t v, uint32_t radix, size_t num_digits) noexcept
 
size_t xtoa (substr s, uint64_t v, uint64_t radix, size_t num_digits) noexcept
 
size_t xtoa (substr s, int8_t v, int8_t radix, size_t num_digits) noexcept
 
size_t xtoa (substr s, int16_t v, int16_t radix, size_t num_digits) noexcept
 
size_t xtoa (substr s, int32_t v, int32_t radix, size_t num_digits) noexcept
 
size_t xtoa (substr s, int64_t v, int64_t radix, size_t num_digits) noexcept
 
size_t xtoa (substr s, float v, int precision, RealFormat_e formatting=FTOA_FLEX) noexcept
 
size_t xtoa (substr s, double v, int precision, RealFormat_e formatting=FTOA_FLEX) noexcept
 
template<class T >
auto xtoa (substr buf, T v) noexcept -> size_t ::type
 
template<class T >
size_t xtoa (substr s, T *v) noexcept
 
bool atox (csubstr s, uint8_t *v) noexcept
 
bool atox (csubstr s, uint16_t *v) noexcept
 
bool atox (csubstr s, uint32_t *v) noexcept
 
bool atox (csubstr s, uint64_t *v) noexcept
 
bool atox (csubstr s, int8_t *v) noexcept
 
bool atox (csubstr s, int16_t *v) noexcept
 
bool atox (csubstr s, int32_t *v) noexcept
 
bool atox (csubstr s, int64_t *v) noexcept
 
bool atox (csubstr s, float *v) noexcept
 
bool atox (csubstr s, double *v) noexcept
 
template<class T >
auto atox (csubstr buf, T *v) noexcept -> bool ::type
 
template<class T >
bool atox (csubstr s, T **v) noexcept
 
size_t to_chars (substr buf, uint8_t v) noexcept
 
size_t to_chars (substr buf, uint16_t v) noexcept
 
size_t to_chars (substr buf, uint32_t v) noexcept
 
size_t to_chars (substr buf, uint64_t v) noexcept
 
size_t to_chars (substr buf, int8_t v) noexcept
 
size_t to_chars (substr buf, int16_t v) noexcept
 
size_t to_chars (substr buf, int32_t v) noexcept
 
size_t to_chars (substr buf, int64_t v) noexcept
 
size_t to_chars (substr buf, float v) noexcept
 
size_t to_chars (substr buf, double v) noexcept
 
template<class T >
auto to_chars (substr buf, T v) noexcept -> size_t ::type
 
template<class T >
size_t to_chars (substr s, T *v) noexcept
 
bool from_chars (csubstr buf, uint8_t *v) noexcept
 
bool from_chars (csubstr buf, uint16_t *v) noexcept
 
bool from_chars (csubstr buf, uint32_t *v) noexcept
 
bool from_chars (csubstr buf, uint64_t *v) noexcept
 
bool from_chars (csubstr buf, int8_t *v) noexcept
 
bool from_chars (csubstr buf, int16_t *v) noexcept
 
bool from_chars (csubstr buf, int32_t *v) noexcept
 
bool from_chars (csubstr buf, int64_t *v) noexcept
 
bool from_chars (csubstr buf, float *v) noexcept
 
bool from_chars (csubstr buf, double *v) noexcept
 
template<class T >
auto from_chars (csubstr buf, T *v) noexcept -> bool ::type
 
template<class T >
bool from_chars (csubstr buf, T **v) noexcept
 
size_t from_chars_first (csubstr buf, uint8_t *v) noexcept
 
size_t from_chars_first (csubstr buf, uint16_t *v) noexcept
 
size_t from_chars_first (csubstr buf, uint32_t *v) noexcept
 
size_t from_chars_first (csubstr buf, uint64_t *v) noexcept
 
size_t from_chars_first (csubstr buf, int8_t *v) noexcept
 
size_t from_chars_first (csubstr buf, int16_t *v) noexcept
 
size_t from_chars_first (csubstr buf, int32_t *v) noexcept
 
size_t from_chars_first (csubstr buf, int64_t *v) noexcept
 
size_t from_chars_first (csubstr buf, float *v) noexcept
 
size_t from_chars_first (csubstr buf, double *v) noexcept
 
template<class T >
auto from_chars_first (csubstr buf, T *v) noexcept -> size_t ::type
 
template<class T >
size_t from_chars_first (csubstr buf, T **v) noexcept
 
template<class T >
substr to_chars_sub (substr buf, T const &v) noexcept
 call to_chars() and return a substr consisting of the written portion of the input buffer. More...
 
size_t to_chars (substr buf, bool v) noexcept
 
bool from_chars (csubstr buf, bool *v) noexcept
 
size_t from_chars_first (csubstr buf, bool *v) noexcept
 
size_t to_chars (substr buf, char v) noexcept
 
bool from_chars (csubstr buf, char *v) noexcept
 extract a single character from a substring More...
 
size_t from_chars_first (csubstr buf, char *v) noexcept
 
size_t to_chars (substr buf, csubstr v) noexcept
 
bool from_chars (csubstr buf, csubstr *v) noexcept
 
size_t from_chars_first (substr buf, csubstr *v) noexcept
 
size_t to_chars (substr buf, substr v) noexcept
 
bool from_chars (csubstr buf, substr *v) noexcept
 
size_t from_chars_first (csubstr buf, substr *v) noexcept
 
template<size_t N>
size_t to_chars (substr buf, const char(&v)[N]) noexcept
 
size_t to_chars (substr buf, const char *v) noexcept
 
template<class T >
size_t to_chars (substr buf, fmt::boolalpha_< T > fmt)
 write a variable as an alphabetic boolean, ie as either true or false More...
 
template<typename T >
std::enable_if< std::is_signed< T >::value, size_t >::type to_chars (substr buf, fmt::integral_< T > fmt)
 format an integer signed type More...
 
template<typename T >
std::enable_if< std::is_signed< T >::value, size_t >::type to_chars (substr buf, fmt::integral_padded_< T > fmt)
 format an integer signed type, pad with zeroes More...
 
template<typename T >
std::enable_if< std::is_unsigned< T >::value, size_t >::type to_chars (substr buf, fmt::integral_< T > fmt)
 format an integer unsigned type More...
 
template<typename T >
std::enable_if< std::is_unsigned< T >::value, size_t >::type to_chars (substr buf, fmt::integral_padded_< T > fmt)
 format an integer unsigned type, pad with zeroes More...
 
template<class T >
bool from_chars (csubstr s, fmt::overflow_checked_< T > wrapper)
 read an integer type, detecting overflow (returns false on overflow) More...
 
template<class T >
bool from_chars (csubstr s, fmt::overflow_checked_< T > *wrapper)
 read an integer type, detecting overflow (returns false on overflow) More...
 
size_t to_chars (substr buf, fmt::real_< float > fmt)
 
size_t to_chars (substr buf, fmt::real_< double > fmt)
 
size_t to_chars (substr buf, fmt::const_raw_wrapper r)
 write a variable in raw binary format, using memcpy More...
 
bool from_chars (csubstr buf, fmt::raw_wrapper *r)
 read a variable in raw binary format, using memcpy More...
 
bool from_chars (csubstr buf, fmt::raw_wrapper r)
 read a variable in raw binary format, using memcpy More...
 
size_t from_chars_first (csubstr buf, fmt::raw_wrapper *r)
 read a variable in raw binary format, using memcpy More...
 
size_t from_chars_first (csubstr buf, fmt::raw_wrapper r)
 read a variable in raw binary format, using memcpy More...
 
template<class T >
size_t to_chars (substr buf, fmt::left_< T > const &align)
 
template<class T >
size_t to_chars (substr buf, fmt::right_< T > const &align)
 
template<class Arg , class... Args>
size_t cat (substr buf, Arg const &a, Args const &...more)
 serialize the arguments, concatenating them to the given fixed-size buffer. More...
 
template<class... Args>
substr cat_sub (substr buf, Args &&...args)
 like c4::cat() but return a substr instead of a size More...
 
template<class Arg , class... Args>
size_t uncat (csubstr buf, Arg &a, Args &...more)
 deserialize the arguments from the given buffer. More...
 
template<class Sep , class Arg , class... Args>
size_t catsep (substr buf, Sep const &sep, Arg const &a, Args const &...more)
 serialize the arguments, concatenating them to the given fixed-size buffer, using a separator between each argument. More...
 
template<class... Args>
substr catsep_sub (substr buf, Args &&...args)
 like c4::catsep() but return a substr instead of a size More...
 
template<class Sep , class Arg , class... Args>
size_t uncatsep (csubstr buf, Sep &sep, Arg &a, Args &...more)
 deserialize the arguments from the given buffer. More...
 
template<class Arg , class... Args>
size_t format (substr buf, csubstr fmt, Arg const &a, Args const &...more)
 using a format string, serialize the arguments into the given fixed-size buffer. More...
 
template<class... Args>
substr format_sub (substr buf, csubstr fmt, Args const &...args)
 like c4::format() but return a substr instead of a size More...
 
template<class Arg , class... Args>
size_t unformat (csubstr buf, csubstr fmt, Arg &a, Args &...more)
 using a format string, deserialize the arguments from the given buffer. More...
 
template<class CharOwningContainer , class... Args>
void catrs (CharOwningContainer *cont, Args const &...args)
 cat+resize: like c4::cat(), but receives a container, and resizes it as needed to contain the result. More...
 
template<class CharOwningContainer , class... Args>
CharOwningContainer catrs (Args const &...args)
 cat+resize: like c4::cat(), but creates and returns a new container sized as needed to contain the result. More...
 
template<class CharOwningContainer , class... Args>
csubstr catrs_append (CharOwningContainer *cont, Args const &...args)
 cat+resize+append: like c4::cat(), but receives a container, and appends to it instead of overwriting it. More...
 
template<class CharOwningContainer , class Sep , class... Args>
void catseprs (CharOwningContainer *cont, Sep const &sep, Args const &...args)
 catsep+resize: like c4::catsep(), but receives a container, and resizes it as needed to contain the result. More...
 
template<class CharOwningContainer , class Sep , class... Args>
CharOwningContainer catseprs (Sep const &sep, Args const &...args)
 catsep+resize: like c4::catsep(), but create a new container with the result. More...
 
template<class CharOwningContainer , class Sep , class... Args>
csubstr catseprs_append (CharOwningContainer *cont, Sep const &sep, Args const &...args)
 catsep+resize+append: like catsep(), but receives a container, and appends the arguments, resizing the container as needed to contain the result. More...
 
template<class CharOwningContainer , class... Args>
void formatrs (CharOwningContainer *cont, csubstr fmt, Args const &...args)
 format+resize: like c4::format(), but receives a container, and resizes it as needed to contain the result. More...
 
template<class CharOwningContainer , class... Args>
CharOwningContainer formatrs (csubstr fmt, Args const &...args)
 format+resize: like c4::format(), but create a new container with the result. More...
 
template<class CharOwningContainer , class... Args>
csubstr formatrs_append (CharOwningContainer *cont, csubstr fmt, Args const &...args)
 format+resize+append: like format(), but receives a container, and appends the arguments, resizing the container as needed to contain the result. More...
 
bool base64_valid (csubstr encoded)
 check that the given buffer is a valid base64 encoding More...
 
size_t base64_encode (substr encoded, cblob data)
 base64-encode binary data. More...
 
size_t base64_decode (csubstr encoded, blob data)
 decode the base64 encoding in the given buffer More...
 
size_t to_chars (substr buf, fmt::const_base64_wrapper b)
 write a variable in base64 format More...
 
size_t from_chars (csubstr buf, fmt::base64_wrapper *b)
 read a variable in base64 format More...
 
substr skip_bom (substr s)
 skip the Byte Order Mark, or get the full string if there is Byte Order Mark. More...
 
csubstr skip_bom (csubstr s)
 skip the Byte Order Mark, or get the full string if there is Byte Order Mark More...
 
substr get_bom (substr s)
 get the Byte Order Mark, or an empty string if there is no Byte Order Mark More...
 
csubstr get_bom (csubstr s)
 get the Byte Order Mark, or an empty string if there is no Byte Order Mark More...
 
size_t first_non_bom (csubstr s)
 return the position of the first character not belonging to the Byte Order Mark, or 0 if there is no Byte Order Mark. More...
 
substr decode_code_point (substr out, csubstr code_point)
 decode the given code_point, writing into the output string in out. More...
 
size_t decode_code_point (uint8_t *buf, size_t buflen, uint32_t code)
 decode the given code point, writing into the output string buf, of size buflen More...
 
c4::substr to_substr (std::string &s) noexcept
 get a writeable view to an existing std::string. More...
 
c4::csubstr to_csubstr (std::string const &s) noexcept
 get a readonly view to an existing std::string. More...
 
bool operator== (c4::csubstr ss, std::string const &s)
 
bool operator!= (c4::csubstr ss, std::string const &s)
 
bool operator>= (c4::csubstr ss, std::string const &s)
 
bool operator> (c4::csubstr ss, std::string const &s)
 
bool operator<= (c4::csubstr ss, std::string const &s)
 
bool operator< (c4::csubstr ss, std::string const &s)
 
bool operator== (std::string const &s, c4::csubstr ss)
 
bool operator!= (std::string const &s, c4::csubstr ss)
 
bool operator>= (std::string const &s, c4::csubstr ss)
 
bool operator> (std::string const &s, c4::csubstr ss)
 
bool operator<= (std::string const &s, c4::csubstr ss)
 
bool operator< (std::string const &s, c4::csubstr ss)
 
size_t to_chars (c4::substr buf, std::string const &s)
 copy a std::string to a writeable substr More...
 
bool from_chars (c4::csubstr buf, std::string *s)
 copy a csubstr to an existing std::string More...
 
c4::csubstr to_csubstr (std::string_view s) noexcept
 create a csubstr from an existing std::string_view. More...
 
bool operator== (c4::csubstr ss, std::string_view s)
 
bool operator!= (c4::csubstr ss, std::string_view s)
 
bool operator>= (c4::csubstr ss, std::string_view s)
 
bool operator> (c4::csubstr ss, std::string_view s)
 
bool operator<= (c4::csubstr ss, std::string_view s)
 
bool operator< (c4::csubstr ss, std::string_view s)
 
bool operator== (std::string_view s, c4::csubstr ss)
 
bool operator!= (std::string_view s, c4::csubstr ss)
 
bool operator<= (std::string_view s, c4::csubstr ss)
 
bool operator< (std::string_view s, c4::csubstr ss)
 
bool operator>= (std::string_view s, c4::csubstr ss)
 
bool operator> (std::string_view s, c4::csubstr ss)
 
size_t to_chars (c4::substr buf, std::string_view s)
 copy an std::string_view to a writeable substr More...
 
template<class Alloc >
c4::substr to_substr (std::vector< char, Alloc > &vec)
 get a substr (writeable string view) of an existing std::vector<char> More...
 
template<class Alloc >
c4::csubstr to_csubstr (std::vector< char, Alloc > const &vec)
 get a csubstr (read-only string) view of an existing std::vector<char> More...
 
template<class Alloc >
bool operator!= (c4::csubstr ss, std::vector< char, Alloc > const &s)
 
template<class Alloc >
bool operator== (c4::csubstr ss, std::vector< char, Alloc > const &s)
 
template<class Alloc >
bool operator>= (c4::csubstr ss, std::vector< char, Alloc > const &s)
 
template<class Alloc >
bool operator> (c4::csubstr ss, std::vector< char, Alloc > const &s)
 
template<class Alloc >
bool operator<= (c4::csubstr ss, std::vector< char, Alloc > const &s)
 
template<class Alloc >
bool operator< (c4::csubstr ss, std::vector< char, Alloc > const &s)
 
template<class Alloc >
bool operator!= (std::vector< char, Alloc > const &s, c4::csubstr ss)
 
template<class Alloc >
bool operator== (std::vector< char, Alloc > const &s, c4::csubstr ss)
 
template<class Alloc >
bool operator>= (std::vector< char, Alloc > const &s, c4::csubstr ss)
 
template<class Alloc >
bool operator> (std::vector< char, Alloc > const &s, c4::csubstr ss)
 
template<class Alloc >
bool operator<= (std::vector< char, Alloc > const &s, c4::csubstr ss)
 
template<class Alloc >
bool operator< (std::vector< char, Alloc > const &s, c4::csubstr ss)
 
template<class Alloc >
size_t to_chars (c4::substr buf, std::vector< char, Alloc > const &s)
 copy a std::vector<char> to a substr More...
 
template<class Alloc >
bool from_chars (c4::csubstr buf, std::vector< char, Alloc > *s)
 copy a csubstr to an existing std::vector<char> More...
 

Detailed Description

(Undefined by default) Use shorter error message from checks/asserts: do not show the check condition in the error message.

Function Documentation

◆ esyms< yml::extra::ievt::EventFlags >()

template<>
c4::EnumSymbols<yml::extra::ievt::EventFlags> c4::esyms< yml::extra::ievt::EventFlags > ( )

Definition at line 1 of file ints_utils.cpp.

32 {
33  static constexpr const EnumSymbols<yml::extra::ievt::EventFlags>::Sym syms[] = {
34  {yml::extra::ievt::KEY_, "KEY_"},
35  {yml::extra::ievt::VAL_, "VAL_"},
36  {yml::extra::ievt::SCLR, "SCLR"},
37  {yml::extra::ievt::BSEQ, "BSEQ"},
38  {yml::extra::ievt::ESEQ, "ESEQ"},
39  {yml::extra::ievt::BMAP, "BMAP"},
40  {yml::extra::ievt::EMAP, "EMAP"},
41  {yml::extra::ievt::ALIA, "ALIA"},
42  {yml::extra::ievt::ANCH, "ANCH"},
43  {yml::extra::ievt::TAG_, "TAG_"},
44  {yml::extra::ievt::PLAI, "PLAI"},
45  {yml::extra::ievt::SQUO, "SQUO"},
46  {yml::extra::ievt::DQUO, "DQUO"},
47  {yml::extra::ievt::LITL, "LITL"},
48  {yml::extra::ievt::FOLD, "FOLD"},
49  {yml::extra::ievt::FLOW, "FLOW"},
50  {yml::extra::ievt::BLCK, "BLCK"},
51  {yml::extra::ievt::BDOC, "BDOC"},
52  {yml::extra::ievt::EDOC, "EDOC"},
53  {yml::extra::ievt::BSTR, "BSTR"},
54  {yml::extra::ievt::ESTR, "ESTR"},
55  {yml::extra::ievt::EXPL, "EXPL"},
56  {yml::extra::ievt::AREN, "AREN"},
57  {yml::extra::ievt::PSTR, "PSTR"},
58  {yml::extra::ievt::UNFILT, "UNFILT"},
59  {yml::extra::ievt::YAML, "YAML"},
60  {yml::extra::ievt::TAGD, "TAGD"},
61  {yml::extra::ievt::TAGV, "TAGV"},
62  };
63  return EnumSymbols<yml::extra::ievt::EventFlags>(syms);
64 }
@ TAGD
tag directive, name : \TAG <name> .......
@ SCLR
scalar (=VAL in test suite events)
@ LITL
scalar: block literal (|)
@ UNFILT
special flag to mark a scalar as unfiltered (when the parser is set not to filter).
@ EMAP
end map (-MAP in test suite events)
@ DQUO
scalar: double-quoted ("")
@ FOLD
scalar: block folded (>)
@ BMAP
begin map (+MAP in test suite events)
@ ESTR
end stream (-STR in test suite events)
@ BSTR
begin stream (+STR in test suite events)
@ BSEQ
begin seq (+SEQ in test suite events)
@ ESEQ
end seq (-SEQ in test suite events)
@ FLOW
container: flow: [] for seqs or {} for maps
@ VAL_
as value special flag to enable look-back in the event array. it signifies that the previous event ha...
@ BDOC
begin doc (+DOC in test suite events)
@ BLCK
container: block
@ AREN
IMPORTANT. Marks events whose string was placed in the arena. This happens when the filtered string i...
@ TAGV
tag directive, value: \TAG ...... <value>
@ YAML
yaml directive: \YAML <version>
@ ALIA
*ref (reference)
@ EDOC
end doc (-DOC in test suite events)
@ EXPL
--- (with BDOC) or ... (with EDOC)
@ SQUO
scalar: single-quoted (')

References c4::yml::extra::ievt::ALIA, c4::yml::extra::ievt::ANCH, c4::yml::extra::ievt::AREN, c4::yml::extra::ievt::BDOC, c4::yml::extra::ievt::BLCK, c4::yml::extra::ievt::BMAP, c4::yml::extra::ievt::BSEQ, c4::yml::extra::ievt::BSTR, c4::yml::extra::ievt::DQUO, c4::yml::extra::ievt::EDOC, c4::yml::extra::ievt::EMAP, c4::yml::extra::ievt::ESEQ, c4::yml::extra::ievt::ESTR, c4::yml::extra::ievt::EXPL, c4::yml::extra::ievt::FLOW, c4::yml::extra::ievt::FOLD, c4::yml::extra::ievt::KEY_, c4::yml::extra::ievt::LITL, c4::yml::extra::ievt::PLAI, c4::yml::extra::ievt::PSTR, c4::yml::extra::ievt::SCLR, c4::yml::extra::ievt::SQUO, c4::yml::extra::ievt::TAG_, c4::yml::extra::ievt::TAGD, c4::yml::extra::ievt::TAGV, c4::yml::extra::ievt::UNFILT, c4::yml::extra::ievt::VAL_, and c4::yml::extra::ievt::YAML.

◆ to_chars() [1/5]

template<typename T >
std::enable_if<std::is_unsigned<T>::value, size_t>::type c4::to_chars ( substr  buf,
fmt::integral_< T >  fmt 
)
inline

format an integer unsigned type

Definition at line 313 of file format.hpp.

314 {
315  return utoa(buf, fmt.val, fmt.radix);
316 }
size_t utoa(substr buf, T v) noexcept
convert an integral unsigned decimal to a string.
Definition: charconv.hpp:1302

References c4::fmt::integral_< T >::radix, utoa(), and c4::fmt::integral_< T >::val.

◆ to_chars() [2/5]

template<typename T >
std::enable_if<std::is_unsigned<T>::value, size_t>::type c4::to_chars ( substr  buf,
fmt::integral_padded_< T >  fmt 
)
inline

format an integer unsigned type, pad with zeroes

Definition at line 322 of file format.hpp.

323 {
324  return utoa(buf, fmt.val, fmt.radix, fmt.num_digits);
325 }

References c4::fmt::integral_padded_< T >::num_digits, c4::fmt::integral_padded_< T >::radix, utoa(), and c4::fmt::integral_padded_< T >::val.

◆ to_substr() [1/2]

c4::substr c4::to_substr ( std::string &  s)
inlinenoexcept

get a writeable view to an existing std::string.

When the string is empty, the returned view will be pointing at the character with value '\0', but the size will be zero.

See also
https://en.cppreference.com/w/cpp/string/basic_string/operator_at

Definition at line 30 of file string.hpp.

31 {
32  #if C4_CPP < 11
33  #error this function will have undefined behavior
34  #endif
35  // since c++11 it is legal to call s[s.size()].
36  return c4::substr(&s[0], s.size()); // NOLINT(readability-container-data-pointer)
37 }

◆ to_csubstr() [1/3]

c4::csubstr c4::to_csubstr ( std::string const &  s)
inlinenoexcept

get a readonly view to an existing std::string.

When the string is empty, the returned view will be pointing at the character with value '\0', but the size will be zero.

See also
https://en.cppreference.com/w/cpp/string/basic_string/operator_at

Definition at line 44 of file string.hpp.

45 {
46  #if C4_CPP < 11
47  #error this function will have undefined behavior
48  #endif
49  // since c++11 it is legal to call s[s.size()].
50  return c4::csubstr(&s[0], s.size()); // NOLINT(readability-container-data-pointer)
51 }

◆ operator==() [1/6]

bool c4::operator== ( c4::csubstr  ss,
std::string const &  s 
)
inline

Definition at line 55 of file string.hpp.

55 { return ss.compare(to_csubstr(s)) == 0; }
c4::csubstr to_csubstr(std::string const &s) noexcept
get a readonly view to an existing std::string.
Definition: string.hpp:44

References to_csubstr().

◆ operator!=() [1/6]

bool c4::operator!= ( c4::csubstr  ss,
std::string const &  s 
)
inline

Definition at line 56 of file string.hpp.

56 { return ss.compare(to_csubstr(s)) != 0; }

References to_csubstr().

◆ operator>=() [1/6]

bool c4::operator>= ( c4::csubstr  ss,
std::string const &  s 
)
inline

Definition at line 57 of file string.hpp.

57 { return ss.compare(to_csubstr(s)) >= 0; }

References to_csubstr().

◆ operator>() [1/6]

bool c4::operator> ( c4::csubstr  ss,
std::string const &  s 
)
inline

Definition at line 58 of file string.hpp.

58 { return ss.compare(to_csubstr(s)) > 0; }

References to_csubstr().

◆ operator<=() [1/6]

bool c4::operator<= ( c4::csubstr  ss,
std::string const &  s 
)
inline

Definition at line 59 of file string.hpp.

59 { return ss.compare(to_csubstr(s)) <= 0; }

References to_csubstr().

◆ operator<() [1/6]

bool c4::operator< ( c4::csubstr  ss,
std::string const &  s 
)
inline

Definition at line 60 of file string.hpp.

60 { return ss.compare(to_csubstr(s)) < 0; }

References to_csubstr().

◆ operator==() [2/6]

bool c4::operator== ( std::string const &  s,
c4::csubstr  ss 
)
inline

Definition at line 62 of file string.hpp.

62 { return ss.compare(to_csubstr(s)) == 0; }

References to_csubstr().

◆ operator!=() [2/6]

bool c4::operator!= ( std::string const &  s,
c4::csubstr  ss 
)
inline

Definition at line 63 of file string.hpp.

63 { return ss.compare(to_csubstr(s)) != 0; }

References to_csubstr().

◆ operator>=() [2/6]

bool c4::operator>= ( std::string const &  s,
c4::csubstr  ss 
)
inline

Definition at line 64 of file string.hpp.

64 { return ss.compare(to_csubstr(s)) <= 0; }

References to_csubstr().

◆ operator>() [2/6]

bool c4::operator> ( std::string const &  s,
c4::csubstr  ss 
)
inline

Definition at line 65 of file string.hpp.

65 { return ss.compare(to_csubstr(s)) < 0; }

References to_csubstr().

◆ operator<=() [2/6]

bool c4::operator<= ( std::string const &  s,
c4::csubstr  ss 
)
inline

Definition at line 66 of file string.hpp.

66 { return ss.compare(to_csubstr(s)) >= 0; }

References to_csubstr().

◆ operator<() [2/6]

bool c4::operator< ( std::string const &  s,
c4::csubstr  ss 
)
inline

Definition at line 67 of file string.hpp.

67 { return ss.compare(to_csubstr(s)) > 0; }

References to_csubstr().

◆ to_chars() [3/5]

size_t c4::to_chars ( c4::substr  buf,
std::string const &  s 
)
inline

copy a std::string to a writeable substr

Definition at line 72 of file string.hpp.

73 {
74  size_t sz = s.size();
75  size_t len = buf.len < sz ? buf.len : sz;
76  buf.copy_from(csubstr(s.data(), len)); // copy only available chars
77  return sz; // return the number of needed chars
78 }

◆ from_chars() [1/2]

bool c4::from_chars ( c4::csubstr  buf,
std::string *  s 
)
inline

copy a csubstr to an existing std::string

Definition at line 81 of file string.hpp.

82 {
83  s->resize(buf.len);
84  substr(&(*s)[0], buf.len).copy_from(buf); // NOLINT
85  return true;
86 }

◆ to_csubstr() [2/3]

c4::csubstr c4::to_csubstr ( std::string_view  s)
inlinenoexcept

create a csubstr from an existing std::string_view.

Definition at line 29 of file string_view.hpp.

30 {
31  return c4::csubstr(s.data(), s.size());
32 }

◆ operator==() [3/6]

bool c4::operator== ( c4::csubstr  ss,
std::string_view  s 
)
inline

Definition at line 37 of file string_view.hpp.

37 { return ss.compare(s.data(), s.size()) == 0; }

◆ operator!=() [3/6]

bool c4::operator!= ( c4::csubstr  ss,
std::string_view  s 
)
inline

Definition at line 38 of file string_view.hpp.

38 { return ss.compare(s.data(), s.size()) != 0; }

◆ operator>=() [3/6]

bool c4::operator>= ( c4::csubstr  ss,
std::string_view  s 
)
inline

Definition at line 39 of file string_view.hpp.

39 { return ss.compare(s.data(), s.size()) >= 0; }

◆ operator>() [3/6]

bool c4::operator> ( c4::csubstr  ss,
std::string_view  s 
)
inline

Definition at line 40 of file string_view.hpp.

40 { return ss.compare(s.data(), s.size()) > 0; }

◆ operator<=() [3/6]

bool c4::operator<= ( c4::csubstr  ss,
std::string_view  s 
)
inline

Definition at line 41 of file string_view.hpp.

41 { return ss.compare(s.data(), s.size()) <= 0; }

◆ operator<() [3/6]

bool c4::operator< ( c4::csubstr  ss,
std::string_view  s 
)
inline

Definition at line 42 of file string_view.hpp.

42 { return ss.compare(s.data(), s.size()) < 0; }

◆ operator==() [4/6]

bool c4::operator== ( std::string_view  s,
c4::csubstr  ss 
)
inline

Definition at line 44 of file string_view.hpp.

44 { return ss.compare(s.data(), s.size()) == 0; }

◆ operator!=() [4/6]

bool c4::operator!= ( std::string_view  s,
c4::csubstr  ss 
)
inline

Definition at line 45 of file string_view.hpp.

45 { return ss.compare(s.data(), s.size()) != 0; }

◆ operator<=() [4/6]

bool c4::operator<= ( std::string_view  s,
c4::csubstr  ss 
)
inline

Definition at line 46 of file string_view.hpp.

46 { return ss.compare(s.data(), s.size()) >= 0; }

◆ operator<() [4/6]

bool c4::operator< ( std::string_view  s,
c4::csubstr  ss 
)
inline

Definition at line 47 of file string_view.hpp.

47 { return ss.compare(s.data(), s.size()) > 0; }

◆ operator>=() [4/6]

bool c4::operator>= ( std::string_view  s,
c4::csubstr  ss 
)
inline

Definition at line 48 of file string_view.hpp.

48 { return ss.compare(s.data(), s.size()) <= 0; }

◆ operator>() [4/6]

bool c4::operator> ( std::string_view  s,
c4::csubstr  ss 
)
inline

Definition at line 49 of file string_view.hpp.

49 { return ss.compare(s.data(), s.size()) < 0; }

◆ to_chars() [4/5]

size_t c4::to_chars ( c4::substr  buf,
std::string_view  s 
)
inline

copy an std::string_view to a writeable substr

Definition at line 55 of file string_view.hpp.

56 {
57  size_t sz = s.size();
58  size_t len = buf.len < sz ? buf.len : sz;
59  buf.copy_from(csubstr(s.data(), len)); // copy only available chars
60  return sz; // return the number of needed chars
61 }

◆ to_substr() [2/2]

template<class Alloc >
c4::substr c4::to_substr ( std::vector< char, Alloc > &  vec)

get a substr (writeable string view) of an existing std::vector<char>

Definition at line 36 of file vector.hpp.

37 {
38  char *data = vec.empty() ? nullptr : vec.data(); // data() may or may not return a null pointer.
39  return c4::substr(data, vec.size());
40 }

◆ to_csubstr() [3/3]

template<class Alloc >
c4::csubstr c4::to_csubstr ( std::vector< char, Alloc > const &  vec)

get a csubstr (read-only string) view of an existing std::vector<char>

Definition at line 44 of file vector.hpp.

45 {
46  const char *data = vec.empty() ? nullptr : vec.data(); // data() may or may not return a null pointer.
47  return c4::csubstr(data, vec.size());
48 }

◆ operator!=() [5/6]

template<class Alloc >
bool c4::operator!= ( c4::csubstr  ss,
std::vector< char, Alloc > const &  s 
)
inline

Definition at line 54 of file vector.hpp.

54 { return ss != to_csubstr(s); }
c4::csubstr to_csubstr(std::vector< char, Alloc > const &vec)
get a csubstr (read-only string) view of an existing std::vector<char>
Definition: vector.hpp:44

References to_csubstr().

◆ operator==() [5/6]

template<class Alloc >
bool c4::operator== ( c4::csubstr  ss,
std::vector< char, Alloc > const &  s 
)
inline

Definition at line 55 of file vector.hpp.

55 { return ss == to_csubstr(s); }

References to_csubstr().

◆ operator>=() [5/6]

template<class Alloc >
bool c4::operator>= ( c4::csubstr  ss,
std::vector< char, Alloc > const &  s 
)
inline

Definition at line 56 of file vector.hpp.

56 { return ss >= to_csubstr(s); }

References to_csubstr().

◆ operator>() [5/6]

template<class Alloc >
bool c4::operator> ( c4::csubstr  ss,
std::vector< char, Alloc > const &  s 
)
inline

Definition at line 57 of file vector.hpp.

57 { return ss > to_csubstr(s); }

References to_csubstr().

◆ operator<=() [5/6]

template<class Alloc >
bool c4::operator<= ( c4::csubstr  ss,
std::vector< char, Alloc > const &  s 
)
inline

Definition at line 58 of file vector.hpp.

58 { return ss <= to_csubstr(s); }

References to_csubstr().

◆ operator<() [5/6]

template<class Alloc >
bool c4::operator< ( c4::csubstr  ss,
std::vector< char, Alloc > const &  s 
)
inline

Definition at line 59 of file vector.hpp.

59 { return ss < to_csubstr(s); }

References to_csubstr().

◆ operator!=() [6/6]

template<class Alloc >
bool c4::operator!= ( std::vector< char, Alloc > const &  s,
c4::csubstr  ss 
)
inline

Definition at line 61 of file vector.hpp.

61 { return ss != to_csubstr(s); }

References to_csubstr().

◆ operator==() [6/6]

template<class Alloc >
bool c4::operator== ( std::vector< char, Alloc > const &  s,
c4::csubstr  ss 
)
inline

Definition at line 62 of file vector.hpp.

62 { return ss == to_csubstr(s); }

References to_csubstr().

◆ operator>=() [6/6]

template<class Alloc >
bool c4::operator>= ( std::vector< char, Alloc > const &  s,
c4::csubstr  ss 
)
inline

Definition at line 63 of file vector.hpp.

63 { return ss <= to_csubstr(s); }

References to_csubstr().

◆ operator>() [6/6]

template<class Alloc >
bool c4::operator> ( std::vector< char, Alloc > const &  s,
c4::csubstr  ss 
)
inline

Definition at line 64 of file vector.hpp.

64 { return ss < to_csubstr(s); }

References to_csubstr().

◆ operator<=() [6/6]

template<class Alloc >
bool c4::operator<= ( std::vector< char, Alloc > const &  s,
c4::csubstr  ss 
)
inline

Definition at line 65 of file vector.hpp.

65 { return ss >= to_csubstr(s); }

References to_csubstr().

◆ operator<() [6/6]

template<class Alloc >
bool c4::operator< ( std::vector< char, Alloc > const &  s,
c4::csubstr  ss 
)
inline

Definition at line 66 of file vector.hpp.

66 { return ss > to_csubstr(s); }

References to_csubstr().

◆ to_chars() [5/5]

template<class Alloc >
size_t c4::to_chars ( c4::substr  buf,
std::vector< char, Alloc > const &  s 
)
inline

copy a std::vector<char> to a substr

Definition at line 73 of file vector.hpp.

74 {
75  size_t sz = s.size();
76  size_t len = buf.len < sz ? buf.len : sz;
77  buf.copy_from(csubstr(s.data(), len)); // copy only available chars
78  return sz; // return the number of needed chars
79 }

◆ from_chars() [2/2]

template<class Alloc >
bool c4::from_chars ( c4::csubstr  buf,
std::vector< char, Alloc > *  s 
)
inline

copy a csubstr to an existing std::vector<char>

Definition at line 83 of file vector.hpp.

84 {
85  s->resize(buf.len);
86  substr(s->data(), buf.len).copy_from(buf);
87  return true;
88 }