summaryrefslogtreecommitdiff
path: root/src/cppunit/Exception.cpp
diff options
context:
space:
mode:
authorBastiaan Bakker <bastiaan.bakker@lifeline.nl>2001-04-28 17:23:32 +0000
committerBastiaan Bakker <bastiaan.bakker@lifeline.nl>2001-04-28 17:23:32 +0000
commit6d95c46d9dc342bea176c8fbcd101db8eba24bef (patch)
tree3a42ea08625f64972f520cbeda2da3c68bbe9692 /src/cppunit/Exception.cpp
parent7e4ccacdbcf2f78005447f16e49d339d2a70e9ca (diff)
downloadcppunit-6d95c46d9dc342bea176c8fbcd101db8eba24bef.tar.gz
Moved files in subdir cppunit to src/cppunit.
Diffstat (limited to 'src/cppunit/Exception.cpp')
-rw-r--r--src/cppunit/Exception.cpp62
1 files changed, 62 insertions, 0 deletions
diff --git a/src/cppunit/Exception.cpp b/src/cppunit/Exception.cpp
new file mode 100644
index 0000000..51835ad
--- /dev/null
+++ b/src/cppunit/Exception.cpp
@@ -0,0 +1,62 @@
+#include "cppunit/Exception.h"
+
+namespace CppUnit {
+
+const std::string
+CppUnit::Exception::UNKNOWNFILENAME =
+ "<unknown>";
+const int CppUnit::Exception::UNKNOWNLINENUMBER = -1;
+
+/// Construct the exception
+CppUnit::Exception::Exception (const Exception& other)
+ : exception (other)
+{
+ m_message = other.m_message;
+ m_lineNumber = other.m_lineNumber;
+ m_fileName = other.m_fileName;
+}
+
+CppUnit::Exception::Exception (std::string message, long lineNumber, std::string fileName)
+ : m_message (message), m_lineNumber (lineNumber), m_fileName (fileName)
+{
+}
+
+
+/// Destruct the exception
+CppUnit::Exception::~Exception ()
+{}
+
+
+/// Perform an assignment
+Exception&
+CppUnit::Exception::operator= (const Exception& other)
+{
+ exception::operator= (other);
+
+ if (&other != this) {
+ m_message = other.m_message;
+ m_lineNumber = other.m_lineNumber;
+ m_fileName = other.m_fileName;
+ }
+
+ return *this;
+}
+
+
+/// Return descriptive message
+const char*
+CppUnit::Exception::what() const throw ()
+{ return m_message.c_str (); }
+
+/// The line on which the error occurred
+long
+CppUnit::Exception::lineNumber ()
+{ return m_lineNumber; }
+
+
+/// The file in which the error occurred
+std::string
+CppUnit::Exception::fileName ()
+{ return m_fileName; }
+
+} // namespace CppUnit