vips-cpp  8.18
libvips C++ binding
VError8.h
1 // Header for error type
2 
3 /*
4 
5  This file is part of VIPS.
6 
7  VIPS is free software; you can redistribute it and/or modify
8  it under the terms of the GNU Lesser General Public License as published by
9  the Free Software Foundation; either version 2 of the License, or
10  (at your option) any later version.
11 
12  This program is distributed in the hope that it will be useful,
13  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  GNU Lesser General Public License for more details.
16 
17  You should have received a copy of the GNU Lesser General Public License
18  along with this program; if not, write to the Free Software
19  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
20  02110-1301 USA
21 
22  */
23 
24 /*
25 
26  These files are distributed with VIPS - http://www.vips.ecs.soton.ac.uk
27 
28  */
29 
30 #ifndef VIPS_VERROR_H
31 #define VIPS_VERROR_H
32 
33 #include <cstring>
34 #include <ostream>
35 #include <stdexcept>
36 
37 #include <vips/vips.h>
38 
39 VIPS_NAMESPACE_START
40 
45 class VIPS_CPLUSPLUS_API VError : public std::runtime_error {
46 public:
47  using std::runtime_error::runtime_error;
48 
53  VError() : std::runtime_error(vips_error_buffer()) {}
54 
60  const char *
61  what() const noexcept override
62  {
63  return std::runtime_error::what();
64  }
65 
69  void ostream_print(std::ostream &) const;
70 
71 private:
75  // TODO: Migrate to [[maybe_unused]] once we require C++17.
76  char _abi_padding[sizeof(std::exception) + sizeof(std::string) -
77  sizeof(std::runtime_error)] G_GNUC_UNUSED = {};
78 };
79 
80 VIPS_NAMESPACE_END
81 
82 #endif /*VIPS_VERROR_H*/
Definition: VError8.h:45
VError()
Definition: VError8.h:53
const char * what() const noexcept override
Definition: VError8.h:61