rapidyaml 0.15.2
parse and emit YAML, and do it fast
Loading...
Searching...
No Matches
c4::yml::WriterOStream< OStream > Struct Template Reference

A writer that outputs to an STL-like ostream. More...

#include <writer_ostream.hpp>

Public Member Functions

 WriterOStream (OStream *s) noexcept
template<size_t N>
void append (const char(&a)[N]) noexcept
void append (csubstr s) noexcept
void append (const char c) noexcept
void append (const char c, size_t num_times) noexcept

Public Attributes

OStream * m_stream

Detailed Description

template<class OStream>
struct c4::yml::WriterOStream< OStream >

A writer that outputs to an STL-like ostream.

Definition at line 19 of file writer_ostream.hpp.

Constructor & Destructor Documentation

◆ WriterOStream()

template<class OStream>
c4::yml::WriterOStream< OStream >::WriterOStream ( OStream * s)
inlinenoexcept

Definition at line 23 of file writer_ostream.hpp.

23: m_stream(s) {}
A writer that outputs to an STL-like ostream.

Member Function Documentation

◆ append() [1/4]

template<class OStream>
template<size_t N>
void c4::yml::WriterOStream< OStream >::append ( const char(&) a[N])
inlinenoexcept

Definition at line 26 of file writer_ostream.hpp.

27 {
28 static_assert(N > 1, "empty string");
29 m_stream->write(a, N - 1);
30 }

◆ append() [2/4]

template<class OStream>
void c4::yml::WriterOStream< OStream >::append ( csubstr s)
inlinenoexcept

Definition at line 32 of file writer_ostream.hpp.

33 {
34 if(s.len)
35 {
39 }
40 }

◆ append() [3/4]

template<class OStream>
void c4::yml::WriterOStream< OStream >::append ( const char c)
inlinenoexcept

Definition at line 42 of file writer_ostream.hpp.

43 {
44 m_stream->put(c);
45 }

◆ append() [4/4]

template<class OStream>
void c4::yml::WriterOStream< OStream >::append ( const char c,
size_t num_times )
inlinenoexcept

Definition at line 47 of file writer_ostream.hpp.

48 {
49 for(size_t i = 0; i < num_times; ++i)
50 m_stream->put(c);
51 }

Member Data Documentation

◆ m_stream

template<class OStream>
OStream* c4::yml::WriterOStream< OStream >::m_stream

Definition at line 21 of file writer_ostream.hpp.


The documentation for this struct was generated from the following file:
  • /home/docs/checkouts/readthedocs.org/user_builds/rapidyaml/checkouts/latest/src/c4/yml/writer_ostream.hpp