rapidyaml  0.10.0
parse and emit YAML, and do it fast
sample Namespace Reference

Classes

struct  ErrorHandlerExample
 this is an example error handler, required for some of the quickstart examples. More...
 
struct  ScopedErrorHandlerExample
 Shows how to easily create a scoped error handler. More...
 
struct  vec2
 example scalar type, serialized and deserialized More...
 
struct  vec3
 example scalar type, serialized and deserialized More...
 
struct  vec4
 example scalar type, serialized and deserialized More...
 
struct  parse_only_vec2
 example scalar type, deserialized only More...
 
struct  parse_only_vec3
 example scalar type, deserialized only More...
 
struct  parse_only_vec4
 example scalar type, deserialized only More...
 
struct  emit_only_vec2
 example scalar type, serialized only More...
 
struct  emit_only_vec3
 example scalar type, serialized only More...
 
struct  emit_only_vec4
 example scalar type, serialized only More...
 
struct  my_seq_type
 example user container type: seq-like More...
 
struct  my_map_type
 example user container type: map-like More...
 
struct  my_type
 example user container type with nested container members. More...
 
struct  GlobalAllocatorExample
 
struct  PerTreeMemoryExample
 an example for a per-tree memory allocator More...
 

Functions

bool report_check (int line, const char *predicate, bool result)
 
template<class CharContainer >
CharContainer file_get_contents (const char *filename)
 load a file from disk and return a newly created CharContainer More...
 
template<class CharContainer >
size_t file_get_contents (const char *filename, CharContainer *v)
 load a file from disk into an existing CharContainer More...
 
template<class CharContainer >
void file_put_contents (const char *filename, CharContainer const &v, const char *access)
 save a buffer into a file More...
 
void file_put_contents (const char *filename, const char *buf, size_t sz, const char *access)
 save a buffer into a file More...
 
void sample_lightning_overview ()
 a lightning tour over most features see sample_quick_overview More...
 
void sample_quick_overview ()
 a brief tour over most features More...
 
void sample_substr ()
 demonstrate usage of ryml::substr and ryml::csubstr More...
 
void sample_parse_file ()
 demonstrate how to load a YAML file from disk to parse with ryml. More...
 
void sample_parse_in_place ()
 demonstrate in-place parsing of a mutable YAML source buffer. More...
 
void sample_parse_in_arena ()
 demonstrate parsing of a read-only YAML source buffer More...
 
void sample_parse_reuse_tree ()
 demonstrate reuse/modification of tree when parsing More...
 
void sample_parse_reuse_parser ()
 Demonstrates reuse of an existing parser. More...
 
void sample_parse_reuse_tree_and_parser ()
 for ultimate speed when parsing multiple times, reuse both the tree and parser More...
 
void sample_iterate_trees ()
 shows how to programatically iterate through trees More...
 
void sample_create_trees ()
 shows how to programatically create trees More...
 
void sample_tree_arena ()
 demonstrates explicit and implicit interaction with the tree's string arena. More...
 
void sample_fundamental_types ()
 ryml provides facilities for serializing and deserializing the C++ fundamental types, including boolean and null values; this is provided by the several overloads in to_chars: generalized chars to value and from_chars: generalized chars to value. More...
 
void sample_empty_null_values ()
 Shows how to deal with empty/null values. More...
 
void sample_formatting ()
 ryml provides facilities for formatting/deformatting (imported from c4core into the ryml namespace). More...
 
void sample_base64 ()
 demonstrates how to read and write base64-encoded blobs. More...
 
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)
 
template<class T >
bool from_chars (ryml::csubstr buf, vec2< T > *v)
 
template<class T >
bool from_chars (ryml::csubstr buf, vec3< T > *v)
 
template<class T >
bool from_chars (ryml::csubstr buf, vec4< T > *v)
 
template<class T >
bool from_chars (ryml::csubstr buf, parse_only_vec2< T > *v)
 
template<class T >
bool from_chars (ryml::csubstr buf, parse_only_vec3< T > *v)
 
template<class T >
bool from_chars (ryml::csubstr buf, parse_only_vec4< T > *v)
 
void sample_user_scalar_types ()
 to add scalar types (ie leaf types converting to/from string), define the functions above for those types. More...
 
template<class T >
void write (ryml::NodeRef *n, my_seq_type< T > const &seq)
 
template<class K , class V >
void write (ryml::NodeRef *n, my_map_type< K, V > const &map)
 
void write (ryml::NodeRef *n, my_type const &val)
 
template<class T >
bool read (ryml::ConstNodeRef const &n, my_seq_type< T > *seq)
 
template<class K , class V >
bool read (ryml::ConstNodeRef const &n, my_map_type< K, V > *map)
 
bool read (ryml::ConstNodeRef const &n, my_type *val)
 
void sample_user_container_types ()
 shows how to serialize/deserialize container types. More...
 
void sample_std_types ()
 demonstrates usage with the std implementations provided by ryml in the ryml_std.hpp header More...
 
void sample_float_precision ()
 control precision of serialized floats More...
 
void sample_emit_to_container ()
 demonstrates how to emit to a linear container of char More...
 
void sample_emit_to_stream ()
 demonstrates how to emit to a stream-like structure More...
 
void sample_emit_to_file ()
 demonstrates how to emit to a FILE* More...
 
void sample_emit_nested_node ()
 just like parsing into a nested node, you can also emit from a nested node. More...
 
void sample_style ()
 [experimental] how to query/set/modify node style. More...
 
void sample_json ()
 shows how to parse and emit JSON. More...
 
void sample_anchors_and_aliases ()
 demonstrates usage with anchors and alias references. More...
 
void sample_anchors_and_aliases_create ()
 demonstrates how to use the API to programatically create anchors and aliases More...
 
void sample_tags ()
 
void sample_tag_directives ()
 
void sample_docs ()
 
void sample_error_handler ()
 demonstrates how to set a custom error handler for ryml More...
 
void sample_global_allocator ()
 demonstrates how to set the global allocator for ryml More...
 
void sample_per_tree_allocator ()
 
void sample_static_trees ()
 shows how to work around the static initialization order fiasco when using a static-duration ryml tree More...
 
void sample_location_tracking ()
 demonstrates how to obtain the (zero-based) location of a node from a recently parsed tree More...
 
int report_checks ()
 
 C4_IF_EXCEPTIONS_ (, static std::jmp_buf s_jmp_env;static std::string s_jmp_msg;) template< class Fn > bool ErrorHandlerExample
 this C-style callback is the one stored and used by ryml. More...