|
rapidyaml 0.14.0
parse and emit YAML, and do it fast
|
To serialize user scalar types, implement the appropriate function to_chars (see also to_chars: generalized chars to value): More...
Functions | |
| template<class T> | |
| size_t | to_chars (ryml::substr buf, vec2< T > v) |
| template<class T> | |
| size_t | to_chars (ryml::substr buf, vec3< T > v) |
| template<class T> | |
| size_t | to_chars (ryml::substr buf, vec4< T > v) |
| template<class T> | |
| size_t | to_chars (ryml::substr buf, emit_only_vec2< T > v) |
| template<class T> | |
| size_t | to_chars (ryml::substr buf, emit_only_vec3< T > v) |
| template<class T> | |
| size_t | to_chars (ryml::substr buf, emit_only_vec4< T > v) |
To serialize user scalar types, implement the appropriate function to_chars (see also to_chars: generalized chars to value):
See the sample sample_user_scalar_types() for an example usage.
Your implementation of to_chars must format v to the given string view + return the number of characters written into it. The view size (buf.len) must be strictly respected. Return the number of characters that need to be written for the value to be completely serialized in the string. So if the return value is larger than buf.len, ryml will know that the buffer resize the buffer and call this again with a larger buffer of the correct size.
In your implementation, you may be interested in using the formatting facilities in Format utilities and Charconv utilities; refer to their documentation for further details. But this is not mandatory, and anything can be used, provided that the implemented to_chars() fulfills its contract, described above.
| size_t to_chars | ( | ryml::substr | buf, |
| vec2< T > | v ) |
Definition at line 3512 of file quickstart.cpp.
| size_t to_chars | ( | ryml::substr | buf, |
| vec3< T > | v ) |
Definition at line 3513 of file quickstart.cpp.
| size_t to_chars | ( | ryml::substr | buf, |
| vec4< T > | v ) |
Definition at line 3514 of file quickstart.cpp.
| size_t to_chars | ( | ryml::substr | buf, |
| emit_only_vec2< T > | v ) |
Definition at line 3516 of file quickstart.cpp.
| size_t to_chars | ( | ryml::substr | buf, |
| emit_only_vec3< T > | v ) |
Definition at line 3517 of file quickstart.cpp.
| size_t to_chars | ( | ryml::substr | buf, |
| emit_only_vec4< T > | v ) |
Definition at line 3518 of file quickstart.cpp.