MVE - Multi-View Environment mve-devel
Loading...
Searching...
No Matches
exception.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2015, Simon Fuhrmann
3 * TU Darmstadt - Graphics, Capture and Massively Parallel Computing
4 * All rights reserved.
5 *
6 * This software may be modified and distributed under the terms
7 * of the BSD 3-Clause license. See the LICENSE.txt file for details.
8 */
9
10#ifndef UTIL_EXCEPTION_HEADER
11#define UTIL_EXCEPTION_HEADER
12
13#include <string>
14#include <stdexcept>
15
16#include "util/defines.h"
17
19
23class Exception : public std::exception, public std::string
24{
25public:
26 Exception (void) throw()
27 { }
28
29 Exception (std::string const& msg) throw() : std::string(msg)
30 { }
31
32 Exception (std::string const& msg, char const* msg2) throw()
33 : std::string(msg)
34 { this->append(msg2); }
35
36 Exception (std::string const& msg, std::string const& msg2) throw()
37 : std::string(msg)
38 { this->append(msg2); }
39
40 virtual ~Exception (void) throw()
41 { }
42
43 virtual const char* what (void) const throw()
44 { return this->c_str(); }
45};
46
47/* ---------------------------------------------------------------- */
48
53{
54public:
55 FileException(std::string const& filename, std::string const& msg) throw()
56 : Exception(msg), filename(filename)
57 { }
58
59 FileException(std::string const& filename, char const* msg) throw()
60 : Exception(msg), filename(filename)
61 { }
62
63 virtual ~FileException (void) throw()
64 { }
65
66public:
67 std::string filename;
68};
69
71
72#endif /* UTIL_EXCEPTION_HEADER */
Universal, simple exception class.
Definition exception.h:24
virtual ~Exception(void)
Definition exception.h:40
virtual const char * what(void) const
Definition exception.h:43
Exception(std::string const &msg, char const *msg2)
Definition exception.h:32
Exception(std::string const &msg)
Definition exception.h:29
Exception(std::string const &msg, std::string const &msg2)
Definition exception.h:36
Exception class for file exceptions with additional filename.
Definition exception.h:53
std::string filename
Definition exception.h:67
virtual ~FileException(void)
Definition exception.h:63
FileException(std::string const &filename, std::string const &msg)
Definition exception.h:55
FileException(std::string const &filename, char const *msg)
Definition exception.h:59
#define UTIL_NAMESPACE_BEGIN
Definition defines.h:13
#define UTIL_NAMESPACE_END
Definition defines.h:14