Function emit
Summary
#include <src/c4/yml/emit.hpp>
(1) size_t emit(Tree const &t, size_t id, FILE *f)
(2) size_t emit(Tree const &t, FILE *f=nullptr)
(3) size_t emit(NodeRef const &r, FILE *f=nullptr)
(4) substr emit(Tree const &t, size_t id, substr buf, bool error_on_excess=true)
(5) substr emit(Tree const &t, substr buf, bool error_on_excess=true)
(6) substr emit(NodeRef const &r, substr buf, bool error_on_excess=true)
Function overload
Synopsis
#include <src/c4/yml/emit.hpp>
size_t emit(Tree const &t, size_t id, FILE *f)
Description
emit YAML to the given file. A null file defaults to stdout. Return the number of bytes written.
Source
Lines 117-122 in src/c4/yml/emit.hpp.
inline size_t emit(Tree const& t, size_t id, FILE *f)
{
EmitterFile em(f);
size_t len = em.emit(YAML, t, id, /*error_on_excess*/true).len;
return len;
}
Synopsis
#include <src/c4/yml/emit.hpp>
size_t emit(Tree const &t, FILE *f=nullptr)
Description
emit YAML to the given file. A null file defaults to stdout. Return the number of bytes written. This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Source
Lines 135-138 in src/c4/yml/emit.hpp.
inline size_t emit(Tree const& t, FILE *f=nullptr)
{
return emit(t, t.root_id(), f);
}
Synopsis
#include <src/c4/yml/emit.hpp>
size_t emit(NodeRef const &r, FILE *f=nullptr)
Description
emit YAML to the given file. A null file defaults to stdout. Return the number of bytes written. This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Source
Lines 150-153 in src/c4/yml/emit.hpp.
inline size_t emit(NodeRef const& r, FILE *f=nullptr)
{
return emit(*r.tree(), r.id(), f);
}
Synopsis
#include <src/c4/yml/emit.hpp>
substr emit(Tree const &t, size_t id, substr buf, bool error_on_excess=true)
Description
emit YAML to the given buffer. Return a substr trimmed to the emitted YAML.
- Parameters
error_on_excess
- Raise an error if the space in the buffer is insufficient. This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Source
Lines 199-204 in src/c4/yml/emit.hpp.
inline substr emit(Tree const& t, size_t id, substr buf, bool error_on_excess=true)
{
EmitterBuf em(buf);
substr result = em.emit(YAML, t, id, error_on_excess);
return result;
}
Synopsis
#include <src/c4/yml/emit.hpp>
substr emit(Tree const &t, substr buf, bool error_on_excess=true)
Description
emit YAML to the given buffer. Return a substr trimmed to the emitted YAML.
- Parameters
error_on_excess
- Raise an error if the space in the buffer is insufficient. This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Source
Lines 218-221 in src/c4/yml/emit.hpp.
inline substr emit(Tree const& t, substr buf, bool error_on_excess=true)
{
return emit(t, t.root_id(), buf, error_on_excess);
}
Synopsis
#include <src/c4/yml/emit.hpp>
substr emit(NodeRef const &r, substr buf, bool error_on_excess=true)
Description
emit YAML to the given buffer. Return a substr trimmed to the emitted YAML.
- Parameters
error_on_excess
- Raise an error if the space in the buffer is insufficient. This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Source
Lines 234-237 in src/c4/yml/emit.hpp.
inline substr emit(NodeRef const& r, substr buf, bool error_on_excess=true)
{
return emit(*r.tree(), r.id(), buf, error_on_excess);
}