20#ifndef PLYWOOT_ASCII_PARSER_POLICY_HPP
21#define PLYWOOT_ASCII_PARSER_POLICY_HPP
57class AsciiParserPolicy
63 AsciiParserPolicy(std::istream &is) : is_{is} {}
69 void skipElement(
const PlyElement &e)
const { is_.skipLines(e.size()); }
74 void skipProperty(
const PlyProperty &p)
const
79 const auto size = readNumber<int>();
80 for (
int i = 0; i < size; ++i) { skipNumber(); }
82 else { skipNumber(); }
92 if (is_.eof()) {
throw UnexpectedEof(); }
95 return detail::to_number<T>(is_.data(), is_.data() + 256, &is_.data());
105 template<
typename PlyT,
typename DestT, std::
size_t N>
106 std::uint8_t *readNumbers(std::uint8_t *dest)
const
109 for (std::size_t i = 0; i < N; ++i, dest +=
sizeof(DestT))
111 *
reinterpret_cast<DestT *
>(dest) = readNumber<PlyT>();
117 template<
typename T =
void>
118 void skipNumber()
const
120 is_.skipWhitespace();
121 is_.skipNonWhitespace();
127 void skipProperties(std::size_t n)
const
129 if (n > 0) is_.skipLines(1);
134 mutable detail::BufferedIStream is_;
Base class for all exceptions thrown by PLYwoot.
Base class for all parser exceptions.
ParserException(const std::string &message)
Unexpected end-of-file exception.
UnexpectedEof()
Constructs an unexpected end-of-file exception.