Namespace yml

Description

No description yet.

Preprocess_json

Convert JSON that may be not YAML to valid YAML.

{"a":"b"} ---> {"a": "b"}

See
https://stackoverflow.com/questions/42124227/why-does-the-yaml-spec-mandate-a-space-after-the-colon
Note
this is recursive - conversion happens on every tree node
Parameters

json - A relaxed map

buf - output buffer

out - output container

preprocess_json overloadWrite into a given output buffer

Preprocess_rxmap

Convert flow-type relaxed maps (with implicit bools) into strict YAML flow map.

{a, b, c, d: [e, f], g: {a, b}}
# is converted into this:
{a: 1, b: 1, c: 1, d: [e, f], g: {a, b}}

Note
this is NOT recursive - conversion happens only in the top-level map
Parameters

rxmap - A relaxed map

buf - output buffer

out - output container

preprocess_rxmap overloadWrite into a given output buffer

Other Types

report_error_impl
Anonymous_0a null position
Anonymous_1an index to none
LineColholds a position into a source buffer
Locationa source file position

using pfn_error = void(*)(const char *msg, size_t msg_len, Location location, void *user_data)

the type of the function used to report errors. This function must interrupt execution, either by raising an exception or calling std::abort().

error overloadtrigger an error: call the current error callback.

using pfn_allocate = void *(*)(size_t len, void *hint, void *user_data)

the type of the function used to allocate memory

using pfn_free = void(*)(void *mem, size_t size, void *user_data)

the type of the function used to free memory

Callbacksa c-style callbacks class
get_callbacksget the global callbacks
set_callbacksset the global callbacks
MemoryResource
set_memory_resourceset the global memory resource
get_memory_resourceget the global memory resource
MemoryResourceCallbacksa memory resource adapter to the c-style allocator
Allocatoran allocator is a lightweight non-owning handle to a memory resource

template <class OStream>
using EmitterOStream = Emitter< WriterOStream< OStream > >

using EmitterFile = Emitter< WriterFile >

using EmitterBuf = Emitter< WriterBuf >

EmitType_e
as_jsonmark a tree or node to be emitted as json
Emitter
emit overloademit YAML to the given file
emit overloademit YAML to the given buffer
emit_json overloademit JSON to the given file
emit_json overloademit JSON to the given buffer
operator<< overloademit YAML to an STL-like ostream
operator<< overloademit YAML to an STL-like ostream This is an overloaded member function, provided for convenience
operator<< overloademit json to the stream
emitrs overloademit+resize: YAML to the given std::string/std::vector-like container, resizing it as needed to fit the emitted YAML.
emitrs_json overloademit+resize: JSON to the given std::string/std::vector-like container, resizing it as needed to fit the emitted JSON.
write overloadstd::map requires child nodes in the data tree hierarchy (a MAP node in ryml parlance)
write overloadvector is a sequence-like type, and it requires child nodes in the data tree hierarchy (a SEQ node in ryml parlance)
read overload

Mentioned in

Key
key
NodeRefa reference to a node in an existing yaml tree, offering a more convenient API than the index-based API used in the tree.
from_next_linelook for the next newline chars, and jump to the right of those
Parser
parse overloadparse in-situ a modifiable YAML source buffer.
parse overloadparse in-situ a modifiable YAML source buffer, providing a filename for error messages.
parse overloadparse a read-only YAML source buffer, copying it first to the tree's source arena.
parse overloadparse a read-only YAML source buffer, copying it first to the tree's source arena, providing a filename for error messages.
parse overloadreusing the YAML tree, parse in-situ a modifiable YAML source buffer
parse overloadreusing the YAML tree, parse in-situ a modifiable YAML source buffer, providing a filename for error messages.
parse overloadreusing the YAML tree, parse a read-only YAML source buffer, copying it first to the tree's source arena.
parse overloadreusing the YAML tree, parse a read-only YAML source buffer, copying it first to the tree's source arena, providing a filename for error messages.

using tag_bits = uint16_t

the integral type necessary to cover all the bits marking node types

typedef uint64_t type_bits

the integral type necessary to cover all the bits marking node types

YamlTag_ea bit mask for marking tags for types
to_tag
NodeType_ea bit mask for marking node types
NodeTypewraps a NodeType_e element with some syntactic sugar and predicates
NodeScalara node scalar is a csubstr, which may be tagged and anchored.
C4_MUST_BE_TRIVIAL_COPY overload
NodeInitconvenience class to initialize nodes
NodeDatacontains the data for each YAML node.
Tree

Mentioned in

RepCRepeat-Character: a character to be written a number of times.
indent_to
WriterFileA writer that outputs to a file
WriterOStreamA writer that outputs to an STL-like ostream.
WriterBufa writer to a substr

Source

Line 9 in src/c4/yml/common.cpp.






Add Discussion as Guest

Log in