|
rapidyaml
0.7.1
parse and emit YAML, and do it fast
|
Lightweight generic type-safe wrappers for converting individual values to/from strings. More...
#include "c4/language.hpp"#include <inttypes.h>#include <type_traits>#include <climits>#include <limits>#include <utility>#include "c4/config.hpp"#include "c4/substr.hpp"#include "c4/std/std_fwd.hpp"#include "c4/memory_util.hpp"#include "c4/szconv.hpp"#include "c4/ext/fast_float.hpp"#include <cstdio>Go to the source code of this file.
Namespaces | |
| c4 | |
Macros | |
| #define | C4CORE_HAVE_STD_TOCHARS 0 |
| #define | C4CORE_HAVE_STD_FROMCHARS 0 |
| #define | C4CORE_HAVE_FAST_FLOAT 1 |
| #define | C4_NO_UBSAN_IOVRFLW |
Enumerations | |
| enum | c4::RealFormat_e : char { c4::FTOA_FLOAT = 'f' , c4::FTOA_SCIENT = 'e' , c4::FTOA_FLEX = 'g' , c4::FTOA_HEXA = 'a' } |
Functions | |
| template<class T > | |
| auto | c4::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 | c4::digits_hex (T v) noexcept |
| return the number of digits required to encode an hexadecimal number. More... | |
| template<class T > | |
| unsigned | c4::digits_bin (T v) noexcept |
| return the number of digits required to encode a binary number. More... | |
| template<class T > | |
| unsigned | c4::digits_oct (T v_) noexcept |
| return the number of digits required to encode an octal number. More... | |
| template<class T > | |
| void | c4::write_dec_unchecked (substr buf, T v, unsigned digits_v) noexcept |
| template<class T > | |
| void | c4::write_hex_unchecked (substr buf, T v, unsigned digits_v) noexcept |
| template<class T > | |
| void | c4::write_oct_unchecked (substr buf, T v, unsigned digits_v) noexcept |
| template<class T > | |
| void | c4::write_bin_unchecked (substr buf, T v, unsigned digits_v) noexcept |
| template<class T > | |
| size_t | c4::write_dec (substr buf, T v) noexcept |
| write an integer to a string in decimal format. More... | |
| template<class T > | |
| size_t | c4::write_hex (substr buf, T v) noexcept |
| write an integer to a string in hexadecimal format. More... | |
| template<class T > | |
| size_t | c4::write_oct (substr buf, T v) noexcept |
| write an integer to a string in octal format. More... | |
| template<class T > | |
| size_t | c4::write_bin (substr buf, T v) noexcept |
| write an integer to a string in binary format. More... | |
| template<class T > | |
| size_t | c4::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 | c4::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 | c4::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 | c4::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 | c4::read_dec (csubstr s, I *v) noexcept |
| read a decimal integer from a string. More... | |
| template<class I > | |
| bool | c4::read_hex (csubstr s, I *v) noexcept |
| read an hexadecimal integer from a string. More... | |
| template<class I > | |
| bool | c4::read_bin (csubstr s, I *v) noexcept |
| read a binary integer from a string. More... | |
| template<class I > | |
| bool | c4::read_oct (csubstr s, I *v) noexcept |
| read an octal integer from a string. More... | |
| template<class T > | |
| size_t | c4::itoa (substr buf, T v) noexcept |
| convert an integral signed decimal to a string. More... | |
| template<class T > | |
| size_t | c4::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 | c4::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 | c4::utoa (substr buf, T v) noexcept |
| convert an integral unsigned decimal to a string. More... | |
| template<class T > | |
| size_t | c4::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 | c4::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 | c4::atoi (csubstr str, T *v) noexcept |
| Convert a trimmed string to a signed integral value. More... | |
| template<class T > | |
| size_t | c4::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 | c4::atou (csubstr str, T *v) noexcept |
| Convert a trimmed string to an unsigned integral value. More... | |
| template<class T > | |
| size_t | c4::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 | c4::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 | c4::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 | c4::dtoa (substr str, double v, int precision=-1, RealFormat_e formatting=FTOA_FLEX) noexcept |
| Convert a double-precision real number to string. More... | |
| bool | c4::atof (csubstr str, float *v) noexcept |
| Convert a string to a single precision real number. More... | |
| size_t | c4::atof_first (csubstr str, float *v) noexcept |
| Convert a string to a single precision real number. More... | |
| bool | c4::atod (csubstr str, double *v) noexcept |
| Convert a string to a double precision real number. More... | |
| size_t | c4::atod_first (csubstr str, double *v) noexcept |
| Convert a string to a double precision real number. More... | |
| size_t | c4::xtoa (substr s, uint8_t v) noexcept |
| size_t | c4::xtoa (substr s, uint16_t v) noexcept |
| size_t | c4::xtoa (substr s, uint32_t v) noexcept |
| size_t | c4::xtoa (substr s, uint64_t v) noexcept |
| size_t | c4::xtoa (substr s, int8_t v) noexcept |
| size_t | c4::xtoa (substr s, int16_t v) noexcept |
| size_t | c4::xtoa (substr s, int32_t v) noexcept |
| size_t | c4::xtoa (substr s, int64_t v) noexcept |
| size_t | c4::xtoa (substr s, float v) noexcept |
| size_t | c4::xtoa (substr s, double v) noexcept |
| size_t | c4::xtoa (substr s, uint8_t v, uint8_t radix) noexcept |
| size_t | c4::xtoa (substr s, uint16_t v, uint16_t radix) noexcept |
| size_t | c4::xtoa (substr s, uint32_t v, uint32_t radix) noexcept |
| size_t | c4::xtoa (substr s, uint64_t v, uint64_t radix) noexcept |
| size_t | c4::xtoa (substr s, int8_t v, int8_t radix) noexcept |
| size_t | c4::xtoa (substr s, int16_t v, int16_t radix) noexcept |
| size_t | c4::xtoa (substr s, int32_t v, int32_t radix) noexcept |
| size_t | c4::xtoa (substr s, int64_t v, int64_t radix) noexcept |
| size_t | c4::xtoa (substr s, uint8_t v, uint8_t radix, size_t num_digits) noexcept |
| size_t | c4::xtoa (substr s, uint16_t v, uint16_t radix, size_t num_digits) noexcept |
| size_t | c4::xtoa (substr s, uint32_t v, uint32_t radix, size_t num_digits) noexcept |
| size_t | c4::xtoa (substr s, uint64_t v, uint64_t radix, size_t num_digits) noexcept |
| size_t | c4::xtoa (substr s, int8_t v, int8_t radix, size_t num_digits) noexcept |
| size_t | c4::xtoa (substr s, int16_t v, int16_t radix, size_t num_digits) noexcept |
| size_t | c4::xtoa (substr s, int32_t v, int32_t radix, size_t num_digits) noexcept |
| size_t | c4::xtoa (substr s, int64_t v, int64_t radix, size_t num_digits) noexcept |
| size_t | c4::xtoa (substr s, float v, int precision, RealFormat_e formatting=FTOA_FLEX) noexcept |
| size_t | c4::xtoa (substr s, double v, int precision, RealFormat_e formatting=FTOA_FLEX) noexcept |
| template<class T > | |
| size_t ::type | c4::xtoa (substr buf, T v) noexcept |
| template<class T > | |
| size_t | c4::xtoa (substr s, T *v) noexcept |
| bool | c4::atox (csubstr s, uint8_t *v) noexcept |
| bool | c4::atox (csubstr s, uint16_t *v) noexcept |
| bool | c4::atox (csubstr s, uint32_t *v) noexcept |
| bool | c4::atox (csubstr s, uint64_t *v) noexcept |
| bool | c4::atox (csubstr s, int8_t *v) noexcept |
| bool | c4::atox (csubstr s, int16_t *v) noexcept |
| bool | c4::atox (csubstr s, int32_t *v) noexcept |
| bool | c4::atox (csubstr s, int64_t *v) noexcept |
| bool | c4::atox (csubstr s, float *v) noexcept |
| bool | c4::atox (csubstr s, double *v) noexcept |
| template<class T > | |
| bool ::type | c4::atox (csubstr buf, T *v) noexcept |
| template<class T > | |
| bool | c4::atox (csubstr s, T **v) noexcept |
| size_t | c4::to_chars (substr buf, uint8_t v) noexcept |
| size_t | c4::to_chars (substr buf, uint16_t v) noexcept |
| size_t | c4::to_chars (substr buf, uint32_t v) noexcept |
| size_t | c4::to_chars (substr buf, uint64_t v) noexcept |
| size_t | c4::to_chars (substr buf, int8_t v) noexcept |
| size_t | c4::to_chars (substr buf, int16_t v) noexcept |
| size_t | c4::to_chars (substr buf, int32_t v) noexcept |
| size_t | c4::to_chars (substr buf, int64_t v) noexcept |
| size_t | c4::to_chars (substr buf, float v) noexcept |
| size_t | c4::to_chars (substr buf, double v) noexcept |
| template<class T > | |
| size_t ::type | c4::to_chars (substr buf, T v) noexcept |
| template<class T > | |
| size_t | c4::to_chars (substr s, T *v) noexcept |
| bool | c4::from_chars (csubstr buf, uint8_t *v) noexcept |
| bool | c4::from_chars (csubstr buf, uint16_t *v) noexcept |
| bool | c4::from_chars (csubstr buf, uint32_t *v) noexcept |
| bool | c4::from_chars (csubstr buf, uint64_t *v) noexcept |
| bool | c4::from_chars (csubstr buf, int8_t *v) noexcept |
| bool | c4::from_chars (csubstr buf, int16_t *v) noexcept |
| bool | c4::from_chars (csubstr buf, int32_t *v) noexcept |
| bool | c4::from_chars (csubstr buf, int64_t *v) noexcept |
| bool | c4::from_chars (csubstr buf, float *v) noexcept |
| bool | c4::from_chars (csubstr buf, double *v) noexcept |
| template<class T > | |
| bool ::type | c4::from_chars (csubstr buf, T *v) noexcept |
| template<class T > | |
| bool | c4::from_chars (csubstr buf, T **v) noexcept |
| size_t | c4::from_chars_first (csubstr buf, uint8_t *v) noexcept |
| size_t | c4::from_chars_first (csubstr buf, uint16_t *v) noexcept |
| size_t | c4::from_chars_first (csubstr buf, uint32_t *v) noexcept |
| size_t | c4::from_chars_first (csubstr buf, uint64_t *v) noexcept |
| size_t | c4::from_chars_first (csubstr buf, int8_t *v) noexcept |
| size_t | c4::from_chars_first (csubstr buf, int16_t *v) noexcept |
| size_t | c4::from_chars_first (csubstr buf, int32_t *v) noexcept |
| size_t | c4::from_chars_first (csubstr buf, int64_t *v) noexcept |
| size_t | c4::from_chars_first (csubstr buf, float *v) noexcept |
| size_t | c4::from_chars_first (csubstr buf, double *v) noexcept |
| template<class T > | |
| size_t ::type | c4::from_chars_first (csubstr buf, T *v) noexcept |
| template<class T > | |
| size_t | c4::from_chars_first (csubstr buf, T **v) noexcept |
| template<class T > | |
| substr | c4::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 | c4::to_chars (substr buf, bool v) noexcept |
| bool | c4::from_chars (csubstr buf, bool *v) noexcept |
| size_t | c4::from_chars_first (csubstr buf, bool *v) noexcept |
| size_t | c4::to_chars (substr buf, char v) noexcept |
| bool | c4::from_chars (csubstr buf, char *v) noexcept |
| extract a single character from a substring More... | |
| size_t | c4::from_chars_first (csubstr buf, char *v) noexcept |
| size_t | c4::to_chars (substr buf, csubstr v) noexcept |
| bool | c4::from_chars (csubstr buf, csubstr *v) noexcept |
| size_t | c4::from_chars_first (substr buf, csubstr *v) noexcept |
| size_t | c4::to_chars (substr buf, substr v) noexcept |
| bool | c4::from_chars (csubstr buf, substr *v) noexcept |
| size_t | c4::from_chars_first (csubstr buf, substr *v) noexcept |
| template<size_t N> | |
| size_t | c4::to_chars (substr buf, const char(&v)[N]) noexcept |
| size_t | c4::to_chars (substr buf, const char *v) noexcept |
Lightweight generic type-safe wrappers for converting individual values to/from strings.
Definition in file charconv.hpp.
| #define C4CORE_HAVE_STD_TOCHARS 0 |
Definition at line 53 of file charconv.hpp.
| #define C4CORE_HAVE_STD_FROMCHARS 0 |
Definition at line 54 of file charconv.hpp.
| #define C4CORE_HAVE_FAST_FLOAT 1 |
Definition at line 55 of file charconv.hpp.
| #define C4_NO_UBSAN_IOVRFLW |
Definition at line 135 of file charconv.hpp.