diff options
| author | Stefan Boberg <[email protected]> | 2026-02-23 11:19:52 +0100 |
|---|---|---|
| committer | GitHub Enterprise <[email protected]> | 2026-02-23 11:19:52 +0100 |
| commit | 9aac0fd369b87e965fb34b5168646387de7ea1cd (patch) | |
| tree | 367a820685a829adbab31cd1374b1af2cece4b7e /thirdparty/ryml/src/c4/yml/std/vector.hpp | |
| parent | changed command names and descriptions to use class members instead of string... (diff) | |
| download | zen-9aac0fd369b87e965fb34b5168646387de7ea1cd.tar.xz zen-9aac0fd369b87e965fb34b5168646387de7ea1cd.zip | |
implement yaml generation (#774)
this implements a yaml generation strategy similar to the JSON generation where we just build a string instead of building a ryml tree.
This also removes the dependency on ryml for reduced binary/build times.
Diffstat (limited to 'thirdparty/ryml/src/c4/yml/std/vector.hpp')
| -rw-r--r-- | thirdparty/ryml/src/c4/yml/std/vector.hpp | 53 |
1 files changed, 0 insertions, 53 deletions
diff --git a/thirdparty/ryml/src/c4/yml/std/vector.hpp b/thirdparty/ryml/src/c4/yml/std/vector.hpp deleted file mode 100644 index 1b6a4610a..000000000 --- a/thirdparty/ryml/src/c4/yml/std/vector.hpp +++ /dev/null @@ -1,53 +0,0 @@ -#ifndef _C4_YML_STD_VECTOR_HPP_ -#define _C4_YML_STD_VECTOR_HPP_ - -#include "c4/yml/node.hpp" -#include <c4/std/vector.hpp> -#include <vector> - -namespace c4 { -namespace yml { - -// vector is a sequence-like type, and it requires child nodes -// in the data tree hierarchy (a SEQ node in ryml parlance). -// So it should be serialized via write()/read(). - - -template<class V, class Alloc> -void write(c4::yml::NodeRef *n, std::vector<V, Alloc> const& vec) -{ - *n |= c4::yml::SEQ; - for(auto const& v : vec) - n->append_child() << v; -} - -template<class V, class Alloc> -bool read(c4::yml::ConstNodeRef const& n, std::vector<V, Alloc> *vec) -{ - vec->resize(n.num_children()); - size_t pos = 0; - for(auto const ch : n) - ch >> (*vec)[pos++]; - return true; -} - -/** specialization: std::vector<bool> uses std::vector<bool>::reference as - * the return value of its operator[]. */ -template<class Alloc> -bool read(c4::yml::ConstNodeRef const& n, std::vector<bool, Alloc> *vec) -{ - vec->resize(n.num_children()); - size_t pos = 0; - bool tmp; - for(auto const ch : n) - { - ch >> tmp; - (*vec)[pos++] = tmp; - } - return true; -} - -} // namespace yml -} // namespace c4 - -#endif // _C4_YML_STD_VECTOR_HPP_ |