1#ifndef _C4_YML_WRITER_HPP_
2#define _C4_YML_WRITER_HPP_
4#ifndef _C4_YML_ERROR_HPP_
50 static_assert(N > 1,
"empty string");
51 (void)fwrite(a,
sizeof(
char), N - 1,
m_file);
59 C4_SUPPRESS_WARNING_GCC_CLANG_WITH_PUSH(
"-Wsign-conversion")
62 C4_SUPPRESS_WARNING_GCC_CLANG_POP
72 void _do_write(
const char c,
size_t num_times)
noexcept
74 for(
size_t i = 0; i < num_times; ++i)
91template<
class OStream>
110 static_assert(N > 1,
"empty string");
119 C4_SUPPRESS_WARNING_GCC_CLANG_WITH_PUSH(
"-Wsign-conversion")
122 C4_SUPPRESS_WARNING_GCC_CLANG_POP
134 for(
size_t i = 0; i < num_times; ++i)
157 else if(error_on_excess)
158 _RYML_ERR_BASIC(
"not enough space in the given buffer");
168 static_assert(N > 1,
"empty string");
169 _RYML_ASSERT_BASIC( !
m_buf.overlaps(a));
177 _RYML_ASSERT_BASIC( ! s.overlaps(
m_buf));
Error utilities used by ryml.
basic_substring< char > substr
a mutable string view
basic_substring< const char > csubstr
an immutable string view
void _do_write(csubstr s) noexcept
void _do_write(const char(&a)[N]) noexcept
void _do_write(csubstr s) noexcept
WriterOStream(OStream &s)
void _do_write(const char c) noexcept
WriterFile(FILE *f=nullptr)
substr _get(bool error_on_excess) const
void _do_write(const char c) noexcept
void _do_write(const char(&a)[N]) noexcept
void _do_write(const char(&a)[N]) noexcept
void _do_write(const char c) noexcept
WriterBuf(substr sp) noexcept
void _do_write(const char c, size_t num_times) noexcept
substr _get(bool) const noexcept
void _do_write(const char c, size_t num_times) noexcept
void _do_write(csubstr s) noexcept
void _do_write(const char c, size_t num_times) noexcept
(Undefined by default) Use shorter error message from checks/asserts: do not show the check condition...
size_t len
the length of the substring
C * str
a restricted pointer to the first character of the substring