mirror of
https://github.com/Unidata/netcdf-cxx4.git
synced 2025-02-23 19:09:11 +08:00
NcException copy constructor and assignment operators defined
This commit is contained in:
parent
127ff36095
commit
4b57c61161
@ -18,6 +18,28 @@ NcException::NcException(const string& exceptionNameIn,const string& complaintIn
|
||||
}
|
||||
}
|
||||
|
||||
NcException::NcException(const NcException& e) throw()
|
||||
: what_msg(nullptr)
|
||||
{
|
||||
try{
|
||||
what_msg = new std::string(*(e.what_msg));
|
||||
}catch(...){
|
||||
what_msg = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
NcException& NcException::operator=(const NcException& e) throw(){
|
||||
if (this != &e){
|
||||
delete what_msg;
|
||||
try{
|
||||
what_msg = new std::string(*(e.what_msg));
|
||||
}catch(...){
|
||||
what_msg = nullptr;
|
||||
}
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
NcException::~NcException()throw() {
|
||||
delete what_msg;
|
||||
}
|
||||
|
@ -24,6 +24,8 @@ namespace netCDF
|
||||
class NcException : public std::exception {
|
||||
public:
|
||||
NcException(const std::string& exceptionName,const std::string& complaint,const char* fileName,int lineNumber);
|
||||
NcException(const NcException& e) throw();
|
||||
NcException& operator=(const NcException& e) throw();
|
||||
virtual ~NcException() throw();
|
||||
const char* what() const throw();
|
||||
private:
|
||||
|
Loading…
Reference in New Issue
Block a user