Commit fbebd3e1 authored by Steven Murray's avatar Steven Murray
Browse files

Added const qualifier to the “rhs” parameter of the copy constructor and

assignment operator of th Exception class.  Not only your friends
(classes) can play with your private parts (m_message and m_serrno) but
so can you.
parent 8a5322c9
......@@ -65,4 +65,5 @@ castor::exception::Backtrace::Backtrace(): m_trace() {
}
free (strings);
}
}
\ No newline at end of file
}
......@@ -37,4 +37,5 @@ namespace castor {
std::string m_trace;
};
}
}
\ No newline at end of file
}
......@@ -34,18 +34,21 @@ castor::exception::Exception::Exception(int se) : m_serrno(se) {}
//------------------------------------------------------------------------------
// copy constructor
//------------------------------------------------------------------------------
castor::exception::Exception::Exception(castor::exception::Exception& ex) {
m_serrno = ex.code();
m_message << ex.getMessage().str();
castor::exception::Exception::Exception(
const castor::exception::Exception& rhs):
std::exception() {
m_serrno = rhs.m_serrno;
m_message << rhs.m_message.str();
}
//------------------------------------------------------------------------------
// assignement operator
// assignment operator
//------------------------------------------------------------------------------
castor::exception::Exception& castor::exception::Exception::operator=(castor::exception::Exception &ex) {
m_serrno = ex.code();
m_message << ex.getMessage().str();
castor::exception::Exception& castor::exception::Exception::operator=(
const castor::exception::Exception &rhs) {
m_serrno = rhs.m_serrno;
m_message << rhs.m_message.str();
return *this;
}
......
......@@ -53,12 +53,12 @@ namespace castor {
/**
* Copy Constructor
*/
Exception(Exception& dbex);
Exception(const Exception& rhs);
/**
* Assignment operator
*/
Exception& operator=(Exception &dbex);
Exception& operator=(const Exception &rhs);
/**
* Empty Destructor, explicitely non-throwing (needed for std::exception
......
......@@ -20,6 +20,7 @@ COMMONLIB_OBJS = compat.o getacct.o getacctent.o getconfent.o \
Csecloader.o castor1compat.o \
../castor/exception/AlreadyInitialized.o \
../castor/exception/BadVersion.o \
../castor/exception/Backtrace.o \
../castor/exception/Busy.o \
../castor/exception/DismountFailed.o \
../castor/exception/Exception.o \
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment