|
rapidyaml
0.16.0
parseandemitYAML,anddoitfast
|
These functions are used by the parser and emitter to convert scalars to and from chars. More...
Functions | |
| bool | c4::yml::scalar_is_null (csubstr s) noexcept |
| YAML-sense query of nullity. More... | |
| bool | c4::yml::scalar_is_plain_number_json (csubstr s) noexcept |
| JSON-sense query of plain number. More... | |
| bool | c4::yml::scalar_is_inf3 (const char *s) noexcept |
| Query if a scalar is inf (inf, Inf, INF) More... | |
| bool | c4::yml::scalar_is_nan3 (const char *s) noexcept |
| Query if a scalar is nan (nan, NaN, Nan, NAN) More... | |
| bool | c4::yml::scalar_is_inf_or_nan3 (const char *s) noexcept |
| Same as scalar_is_inf3() || scalar_is_nan3() More... | |
| bool | c4::yml::scalar_is_special_json (csubstr s) noexcept |
| Query if a scalar is plain, eg, true, false, null, +-.inf or .nan. More... | |
| template<class T > | |
| bool | c4::yml::from_chars_float (csubstr scalar, T *val) RYML_NOEXCEPT |
| Deserialize a floating point from string. More... | |
| template<class T > | |
| size_t | c4::yml::to_chars_float (substr buf, T val) RYML_NOEXCEPT |
| Serialize a floating point value to a string. More... | |
| template<class T > | |
| bool | c4::yml::from_chars_integral (csubstr scalar, T *val) RYML_NOEXCEPT |
| Deserialize an integral scalar. More... | |
| template<class T > | |
| bool | c4::yml::scalar_deserialize (csubstr str, T *val) |
| Deserialize a scalar from its string representation, dispatching to one of from_chars(), from_chars_float() or from_chars_integral() as appropriate. More... | |
| template<class T > | |
| size_t | c4::yml::scalar_serialize (substr buf, T const &a) |
| Serialize a scalar to the buffer, dispatching to to_chars() or to_chars_float() as appropriate. More... | |
These functions are used by the parser and emitter to convert scalars to and from chars.
|
inlinenoexcept |
YAML-sense query of nullity.
returns true if the scalar points to nullptr or is otherwise equal to one of the strings "~","null","Null","NULL"
Definition at line 28 of file scalar_charconv.hpp.
Referenced by c4::yml::Tree::key_is_null(), sample_empty_null_values(), and c4::yml::Tree::val_is_null().
|
inlinenoexcept |
JSON-sense query of plain number.
Definition at line 39 of file scalar_charconv.hpp.
Referenced by c4::yml::scalar_style_choose_json().
|
inlinenoexcept |
Query if a scalar is inf (inf, Inf, INF)
Definition at line 57 of file scalar_charconv.hpp.
Referenced by c4::yml::scalar_is_special_json().
|
inlinenoexcept |
Query if a scalar is nan (nan, NaN, Nan, NAN)
Definition at line 72 of file scalar_charconv.hpp.
|
inlinenoexcept |
Same as scalar_is_inf3() || scalar_is_nan3()
Definition at line 88 of file scalar_charconv.hpp.
Referenced by c4::yml::scalar_is_special_json().
|
inlinenoexcept |
Query if a scalar is plain, eg, true, false, null, +-.inf or .nan.
Definition at line 105 of file scalar_charconv.hpp.
Referenced by c4::yml::scalar_style_choose_json().
| bool c4::yml::from_chars_float | ( | csubstr | scalar, |
| T * | val | ||
| ) |
Deserialize a floating point from string.
Accepts special values: .nan, .inf, -.inf, with upper-case variations.
Unlike non-floating types, only the leading part of the string that may constitute a number is processed. This happens because the float parsing is delegated to fast_float, which is implemented that way. Consequently, for example, all of "34", "34 " "34hg" "34 gh" will be read as 34. If you are not sure about the contents of the data, you can use csubstr::first_real_span() to check before deserializing, for example like this:
Definition at line 183 of file scalar_charconv.hpp.
Referenced by c4::yml::scalar_deserialize().
| size_t c4::yml::to_chars_float | ( | substr | buf, |
| T | val | ||
| ) |
Serialize a floating point value to a string.
Definition at line 202 of file scalar_charconv.hpp.
Referenced by c4::yml::scalar_serialize().
|
inline |
Deserialize an integral scalar.
Trims leading +, and then dispatches to from_chars<T>(). The full string is used.
to_chars_integral(), because the lower-level atoi() and atou() functions used by to_chars() do not produce leading + characters. Definition at line 227 of file scalar_charconv.hpp.
Referenced by c4::yml::scalar_deserialize().
|
inline |
Deserialize a scalar from its string representation, dispatching to one of from_chars(), from_chars_float() or from_chars_integral() as appropriate.
if constexpr is not available, and the implementation reverts to SFINAE to achieve the compile-time dispatch.Definition at line 254 of file scalar_charconv.hpp.
Referenced by c4::yml::read(), and c4::yml::read_key().
|
inline |
Serialize a scalar to the buffer, dispatching to to_chars() or to_chars_float() as appropriate.
if constexpr is not available, and the implementation reverts to SFINAE to achieve the compile-time dispatch.Definition at line 308 of file scalar_charconv.hpp.
Referenced by c4::yml::serialize_to_arena_scalar().