KiCad PCB EDA Suite
Loading...
Searching...
No Matches
vrml_line_reader.h
Go to the documentation of this file.
1/*
2 * This program source code file is part of KiCad, a free EDA CAD application.
3 *
4 * Copyright The KiCad Developers, see AUTHORS.txt for contributors.
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 3 of the License, or (at your option)
9 * any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, you may find one here:
18 * http://www.gnu.org/licenses/old-licenses/gpl-3.0.html
19 */
20
21#ifndef VRML_LINE_READER_H
22#define VRML_LINE_READER_H
23
24#include <cstddef>
25#include <cstdio>
26#include <string>
27#include <vector>
28
29#include <wx/string.h>
30
32
33
35{
36public:
37 VRML_LINE_READER( const wxString& aFileName, unsigned aStartingLineNumber, unsigned aMaxLineLength,
38 const S3D::MODEL_IMPORT_OPTIONS& aOptions );
40
43
44 char* ReadLine();
45 const char* Line() const { return m_line.data(); }
46 unsigned LineNumber() const { return m_lineNumber; }
47 const wxString& Source() const { return m_source; }
48
49private:
51 bool fill();
52
53 FILE* m_file = nullptr;
54 wxString m_source;
55 std::string m_line;
56 std::vector<char> m_buffer;
57 std::size_t m_bufferPos = 0;
58 std::size_t m_bufferEnd = 0;
59 unsigned m_lineNumber = 0;
60 unsigned m_maxLineLength = 0;
62};
63
64#endif
std::size_t m_bufferEnd
std::vector< char > m_buffer
std::size_t m_bufferPos
const wxString & Source() const
const char * Line() const
VRML_LINE_READER(const VRML_LINE_READER &)=delete
unsigned LineNumber() const
S3D::MODEL_IMPORT_OPTIONS m_options
bool fill()
Refill the read buffer, returning false at end of file or on a read error.
VRML_LINE_READER & operator=(const VRML_LINE_READER &)=delete
VRML_LINE_READER(const wxString &aFileName, unsigned aStartingLineNumber, unsigned aMaxLineLength, const S3D::MODEL_IMPORT_OPTIONS &aOptions)