LBIBCell
 All Classes Functions Variables Friends Pages
Exception.cpp
1 /* Copyright (c) 2013 David Sichau <mail"at"sichau"dot"eu>
2  * 2013 Simon Tanaka <tanakas"at"gmx"dot"ch>
3  *
4  * Permission is hereby granted, free of charge, to any person obtaining a copy
5  * of this software and associated documentation files (the "Software"), to deal
6  * in the Software without restriction, including without limitation the rights
7  * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8  * copies of the Software, and to permit persons to whom the Software is
9  * furnished to do so, subject to the following conditions:
10  *
11  * The above copyright notice and this permission notice shall be included in
12  * all copies or substantial portions of the Software.
13  *
14  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19  * THE SOFTWARE.
20  *
21  */
22 #include <UtilLib/include/Exception.hpp>
23 #include <string>
24 namespace UtilLib {
25 
26  Exception::Exception(const char* message)
27  : msg_(message)
28  {}
29 
30  Exception::Exception(const std::string& message)
31  : msg_(message)
32  {}
33 
34  Exception::Exception(const std::string &message, const char *file, int line)
35  : msg_(message)
36  {
37  std::ostringstream o;
38  o << file << ":" << line << ": " << message;
39  msg_ = o.str();
40  }
41 
43  {}
44 
45  const char* Exception::what() const throw() {
46  return msg_.c_str();
47  }
48 } // end namespace
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