20#ifndef PLYWOOT_ASCII_WRITER_POLICY_HPP
21#define PLYWOOT_ASCII_WRITER_POLICY_HPP
29namespace plywoot::detail {
37 U operator()(U &&u)
const
42 int operator()(
char c)
const {
return static_cast<int>(c); }
43 int operator()(
signed char c)
const {
return static_cast<int>(c); }
44 unsigned operator()(
unsigned char c)
const {
return static_cast<unsigned>(c); }
50class AsciiWriterPolicy
53 AsciiWriterPolicy(std::ostream &os) : os_{os} {}
58 void writeNumber(T t)
const
60 os_.writeAscii(CharToInt<T>{}(t));
68 template<
typename PlySizeT,
typename PlyT,
typename SrcT>
69 void writeList(
const SrcT *t, std::size_t n)
const
75 writeNumbers<PlyT, SrcT>(t, n);
83 template<
typename PlyT,
typename SrcT>
84 void writeNumbers(
const SrcT *t, std::size_t n)
const
86 for (std::size_t i = 0; i < n - 1; ++i)
98 void writeMissingProperties(PlyPropertyConstIterator first, PlyPropertyConstIterator last)
const
100 while (first++ != last) { os_.write(
" 0", 2); }
104 void writeNewline()
const { os_.put(
'\n'); }
107 void writeTokenSeparator()
const { os_.put(
' '); }
110 mutable detail::BufferedOStream os_;