LBIBCell
 All Classes Functions Variables Friends Pages
Exception.hpp
1 /* Copyright (c) 2005 - 2012 Marc de Kamps
2  * 2010 Marc Kirchner
3  * 2013 David Sichau <mail"at"sichau"dot"eu>
4  * 2013 Simon Tanaka <tanakas"at"gmx"dot"ch>
5  *
6  * Permission is hereby granted, free of charge, to any person obtaining a copy
7  * of this software and associated documentation files (the "Software"), to deal
8  * in the Software without restriction, including without limitation the rights
9  * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10  * copies of the Software, and to permit persons to whom the Software is
11  * furnished to do so, subject to the following conditions:
12  *
13  * The above copyright notice and this permission notice shall be included in
14  * all copies or substantial portions of the Software.
15  *
16  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21  * THE SOFTWARE.
22  */
23 
24 #ifndef UTILIB_EXCEPTION_HPP_
25 #define UTILIB_EXCEPTION_HPP_
26 
27 
28 #include <exception>
29 #include <sstream>
30 #include <stdexcept>
31 #include <string>
32 
33 namespace UtilLib {
37 class Exception : public std::exception {
38 
39  public:
46  explicit Exception(const char* message);
47 
51  explicit Exception(const std::string& message);
52 
58  explicit Exception(const std::string& message,const char *file, int line);
59 
63  virtual ~Exception() throw();
64 
70  virtual const char* what() const throw();
71 
72  protected:
75  std::string msg_;
76 };
77 
78 
79 
80 
81 } // end namespace
82 
83 
84 
85 
86 
87 
90 #define lbm_fail(ERROR_MESSAGE) throw(UtilLib::Exception(ERROR_MESSAGE, __FILE__, __LINE__))
91 
92 #endif // UTILIB_EXCEPTION_HPP_
std::string msg_
Definition: Exception.hpp:75
virtual const char * what() const
Definition: Exception.cpp:45
Exception(const char *message)
Definition: Exception.cpp:26
virtual ~Exception()
Definition: Exception.cpp:42