1 #ifndef C4_YML_EMIT_HPP_
2 #define C4_YML_EMIT_HPP_
7 #ifndef C4_YML_EMIT_BUF_HPP_
10 #ifndef C4_YML_EMIT_CONTAINER_HPP_
13 #ifndef C4_YML_EMIT_FILE_HPP_
16 #ifndef C4_YML_EMIT_OSTREAM_HPP_
30 #define RYML_DEPRECATE_EMIT \
31 RYML_DEPRECATED("use emit_yaml() instead. " \
32 "See https://github.com/biojppm/rapidyaml/issues/120")
33 #define RYML_DEPRECATE_EMITRS \
34 RYML_DEPRECATED("use emitrs_yaml() instead. " \
35 "See https://github.com/biojppm/rapidyaml/issues/120")
41 #define RYML_TMP_EMIT_ emit
45 RYML_DEPRECATE_EMIT
inline void emit(Tree
const& t,
id_type id, FILE *f)
49 RYML_DEPRECATE_EMIT
inline void emit(Tree
const& t, FILE *f=
nullptr)
53 RYML_DEPRECATE_EMIT
inline void emit(ConstNodeRef
const& r, FILE *f=
nullptr)
58 RYML_DEPRECATE_EMIT
inline substr emit(Tree
const& t,
id_type id,
substr buf,
bool error_on_excess=
true)
60 return emit_yaml(t,
id, buf, error_on_excess);
62 RYML_DEPRECATE_EMIT
inline substr emit(Tree
const& t,
substr buf,
bool error_on_excess=
true)
64 return emit_yaml(t, buf, error_on_excess);
66 RYML_DEPRECATE_EMIT
inline substr emit(ConstNodeRef
const& r,
substr buf,
bool error_on_excess=
true)
68 return emit_yaml(r, buf, error_on_excess);
72 #define emit RYML_TMP_EMIT_
76 template<
class CharOwningContainer>
77 RYML_DEPRECATE_EMITRS
substr emitrs(Tree
const& t,
id_type id, CharOwningContainer * cont)
81 template<
class CharOwningContainer>
82 RYML_DEPRECATE_EMITRS CharOwningContainer emitrs(Tree
const& t,
id_type id)
84 return emitrs_yaml<CharOwningContainer>(t, id);
86 template<
class CharOwningContainer>
87 RYML_DEPRECATE_EMITRS
substr emitrs(Tree
const& t, CharOwningContainer * cont)
91 template<
class CharOwningContainer>
92 RYML_DEPRECATE_EMITRS CharOwningContainer emitrs(Tree
const& t)
94 return emitrs_yaml<CharOwningContainer>(t);
96 template<
class CharOwningContainer>
97 RYML_DEPRECATE_EMITRS
substr emitrs(ConstNodeRef
const& n, CharOwningContainer * cont)
101 template<
class CharOwningContainer>
102 RYML_DEPRECATE_EMITRS CharOwningContainer emitrs(ConstNodeRef
const& n)
104 return emitrs_yaml<CharOwningContainer>(n);
107 #undef RYML_DEPRECATE_EMIT
108 #undef RYML_DEPRECATE_EMITRS
substr emitrs_yaml(Tree const &t, id_type id, EmitOptions const &opts, CharOwningContainer *cont, bool append=false)
(1) emit+resize: emit YAML to the given std::string/std::vector-like container, resizing it as needed to fit the emitted YAML.
RYML_ID_TYPE id_type
The type of a node id in the YAML tree; to override the default type, define the macro RYML_ID_TYPE t...
basic_substring< char > substr
a mutable string view
Utilities to emit YAML and JSON to buffers or containers.
substr emit_yaml(Tree const &t, EmitOptions const &opts, substr buf, bool error_on_excess)
(1) emit YAML to the given buffer.
emit to STL-like ostreams