Namespace sample

Description

tbese are only needed for the examples below

<ryml_std.hpp> is only needed if interop with std types is desired. ryml itself does not use any STL container. CONTENTS:

(Each function addresses a topic and is fully self-contained. Jump to the function to find out about its topic.)

Summary

sample_quick_overviewbriefly skim over most of the features
sample_substrabout ryml's string views (from c4core)
sample_parse_fileready-to-go example of parsing a file from disk
sample_parse_read_onlyparse a read-only YAML source buffer
sample_parse_in_situparse an immutable YAML source buffer
sample_parse_reuse_treeparse into an existing tree, maybe into a node
sample_parse_reuse_parserreuse an existing parser
sample_parse_reuse_tree_and_parserhow to reuse existing trees and parsers
sample_iterate_treesvisit individual nodes and iterate through trees
sample_create_treesprogramatically create trees
sample_tree_arenainteract with the tree's serialization arena
sample_fundamental_typesserialize/deserialize fundamental types
sample_formattingcontrol formatting when serializing/deserializing
sample_base64encode/decode base64
sample_user_scalar_typesserialize/deserialize scalar (leaf/string) types
sample_user_container_typesserialize/deserialize container (map or seq) types
sample_std_typesserialize/deserialize STL containers
sample_emit_to_containeremit to memory, eg a string or vector-like container
sample_emit_to_streamemit to a stream, eg std::ostream
sample_emit_to_fileemit to a FILE*
sample_emit_nested_nodepick a nested node as the root when emitting
sample_jsonJSON parsing and emitting.
sample_anchors_and_aliasesdeal with YAML anchors and aliases
sample_tagsdeal with YAML type tags
sample_docsdeal with YAML docs
sample_error_handlerset a custom error handler
sample_global_allocatorset a global allocator for ryml
sample_per_tree_allocatorset per-tree allocators
report_checks
report_check
file_get_contents overloadhelper functions for sample_parse_file()
file_put_contents overloadsave a buffer into a file
vec2user scalar types: implemented in ryml through to_chars() + from_chars()
vec3
vec4
parse_only_vec2
parse_only_vec3
parse_only_vec4
emit_only_vec2
emit_only_vec3
emit_only_vec4
to_chars overloadto_chars(): only needed for emitting
from_chars overloadfrom_chars(): only needed for parsing
my_seq_typeuser container type: seq-like
write overload
read overload
my_map_typeuser container type: map-like
my_typeuser container type: notice all the members are complex types defined above
ErrorHandlerExample
GlobalAllocatorExamplePlease note the following about the use of custom allocators with ryml
PerTreeMemoryExample
C4_SUPPRESS_WARNING_MSVC_WITH_PUSHhelper functions for sample_parse_file()

CharContainer * v { ::FILE *fp = ::fopen(filename, "rb")

C4_CHECK_MSG

long sz = ::ftell(fp)

resize
if
size

Source

Line 47 in samples/quickstart.cpp.






Add Discussion as Guest

Log in