vips-cpp  8.16
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 <exception>
36 
37 #include <vips/vips.h>
38 
39 VIPS_NAMESPACE_START
40 
45 class VIPS_CPLUSPLUS_API VError : public std::exception {
46  std::string _what;
47 
48 public:
52  VError(const std::string &what) : _what(what) {}
53 
58  VError() : _what(vips_error_buffer()) {}
59 
60  virtual ~VError() throw() {}
61 
65  virtual const char *
66  what() const throw()
67  {
68  return _what.c_str();
69  }
70 
74  void ostream_print(std::ostream &) const;
75 };
76 
77 VIPS_NAMESPACE_END
78 
79 #endif /*VIPS_VERROR_H*/
Definition: VError8.h:45
VError(const std::string &what)
Definition: VError8.h:52
VError()
Definition: VError8.h:58
virtual const char * what() const
Definition: VError8.h:66