EBGeometry
Compact, header-only C++ library for fast evaluation of signed distance functions
Loading...
Searching...
No Matches
EBGeometry_ParseError.hpp
Go to the documentation of this file.
1// SPDX-FileCopyrightText: 2026 Robert Marskar <robert.marskar@sintef.no>
2//
3// SPDX-License-Identifier: GPL-3.0-or-later
4
11#ifndef EBGEOMETRY_PARSEERROR_HPP
12#define EBGEOMETRY_PARSEERROR_HPP
13
14#include <cstddef>
15#include <stdexcept>
16#include <string>
17
18namespace EBGeometry {
19namespace Parser {
20
28class ParseError : public std::runtime_error
29{
30public:
37 ParseError(const std::string& a_file, const std::size_t a_line, const std::string& a_reason)
38 : std::runtime_error(a_file + (a_line > 0 ? ":" + std::to_string(a_line) : std::string()) + ": " + a_reason),
39 m_file(a_file),
40 m_line(a_line),
41 m_reason(a_reason)
42 {}
43
48 [[nodiscard]] const std::string&
49 file() const noexcept
50 {
51 return m_file;
52 }
53
58 [[nodiscard]] std::size_t
59 line() const noexcept
60 {
61 return m_line;
62 }
63
68 [[nodiscard]] const std::string&
69 reason() const noexcept
70 {
71 return m_reason;
72 }
73
74private:
75 std::string m_file;
76 std::size_t m_line;
77 std::string m_reason;
78};
79
88enum class OnDefect
89{
90 Throw,
91 Warn
92};
93
94} // namespace Parser
95} // namespace EBGeometry
96
97#endif
Thrown by the file readers, and by PolygonSoup::clean() and convertToDCEL(), when a file cannot be re...
Definition EBGeometry_ParseError.hpp:29
const std::string & reason() const noexcept
What is wrong.
Definition EBGeometry_ParseError.hpp:69
ParseError(const std::string &a_file, const std::size_t a_line, const std::string &a_reason)
Constructor.
Definition EBGeometry_ParseError.hpp:37
std::size_t line() const noexcept
Line where the problem was found.
Definition EBGeometry_ParseError.hpp:59
const std::string & file() const noexcept
File being read.
Definition EBGeometry_ParseError.hpp:49
OnDefect
What a file reader does with a mesh whose faces do not form a clean, closed surface.
Definition EBGeometry_ParseError.hpp:89
@ Warn
Print a warning to std::cerr and load the mesh anyway.
@ Throw
Throw a ParseError naming the defect. The default.
Namespace containing all of EBGeometry's functionality.
Definition EBGeometry_Affine.hpp:26