Blender V5.3
ply_import_buffer.hh
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2023 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
8
9#pragma once
10
11#include <cstdio>
12#include <optional>
13
14#include "BLI_array.hh"
15#include "BLI_span.hh"
16
17namespace blender::io::ply {
18
24 public:
25 PlyReadBuffer(const char *file_path, size_t read_buffer_size = 64 * 1024);
27
29 void after_header(bool is_binary);
30
35
37 std::optional<Span<char>> try_read_line();
38
43 bool read_bytes(void *dst, size_t size);
44
45 private:
46 bool refill_buffer();
47
48 FILE *file_ = nullptr;
49 Array<char> buffer_;
50 int pos_ = 0;
51 int buf_used_ = 0;
52 int last_newline_ = 0;
53 size_t read_buffer_size_ = 0;
54 bool at_eof_ = false;
55 bool is_binary_ = false;
56};
57
58} // namespace blender::io::ply
PlyReadBuffer(const char *file_path, size_t read_buffer_size=64 *1024)
std::optional< Span< char > > try_read_line()
bool read_bytes(void *dst, size_t size)