summaryrefslogtreecommitdiffstats
path: root/c++/src/H5Exception.h
diff options
context:
space:
mode:
authorBinh-Minh Ribler <bmribler@hdfgroup.org>2004-03-22 02:56:59 (GMT)
committerBinh-Minh Ribler <bmribler@hdfgroup.org>2004-03-22 02:56:59 (GMT)
commit9e3178fedfab5caa9eed7395ac2d2a9b9a8a7130 (patch)
tree8003f306aaef942d32adc30235aa818772a052dd /c++/src/H5Exception.h
parent7fb0362eeda413222426613058a51282d25d0235 (diff)
downloadhdf5-9e3178fedfab5caa9eed7395ac2d2a9b9a8a7130.zip
hdf5-9e3178fedfab5caa9eed7395ac2d2a9b9a8a7130.tar.gz
hdf5-9e3178fedfab5caa9eed7395ac2d2a9b9a8a7130.tar.bz2
[svn-r8269] Purpose:
Cleaning up warnings Description: Many exception constructors have warnings about reference to temporary location because of the parameter initialization, for example, "const string& var = 0." Solution: Changed "string&" parameters to pass by value for these constructors. Consequently, passing string by value also takes care of char pointers so the overloaded constructors for char pointers are then removed. Also, instead of setting Exception::detailMessage to null string, I set it to DEFAULT_MSG ("No detailed information provided") by default. Platforms: SunOS 5.7 (arabica) Linux 2.4 (eirene) IA-64 (titan)
Diffstat (limited to 'c++/src/H5Exception.h')
-rw-r--r--c++/src/H5Exception.h37
1 files changed, 15 insertions, 22 deletions
diff --git a/c++/src/H5Exception.h b/c++/src/H5Exception.h
index 2ae9093..5a86b31 100644
--- a/c++/src/H5Exception.h
+++ b/c++/src/H5Exception.h
@@ -32,8 +32,7 @@ class H5_DLLCPP Exception {
// Creates an exception with a function name where the failure occurs
// and an optional detailed message
- Exception( const string& func_name, const string& message = 0);
- Exception( const char* func_name, const char* message = NULL);
+ Exception(const string func_name, const string message = DEFAULT_MSG);
// copy constructor
Exception( const Exception& orig);
@@ -85,85 +84,79 @@ class H5_DLLCPP Exception {
#endif
string detailMessage;
string funcName;
+ protected:
+ // Default value for detailMessage
+ static const string DEFAULT_MSG;
+
};
class H5_DLLCPP FileIException : public Exception {
public:
FileIException();
- FileIException( const string& func_name, const string& message = NULL);
- FileIException( const char* func_name, const char* message = NULL);
+ FileIException(const string func_name, const string message = DEFAULT_MSG);
virtual ~FileIException();
};
class H5_DLLCPP GroupIException : public Exception {
public:
GroupIException();
- GroupIException( const string& func_name, const string& message=NULL);
- GroupIException( const char* func_name, const char* message = NULL);
+ GroupIException(const string func_name, const string message = DEFAULT_MSG);
virtual ~GroupIException();
};
class H5_DLLCPP DataSpaceIException : public Exception {
public:
DataSpaceIException();
- DataSpaceIException(const string& func_name, const string& message=NULL);
- DataSpaceIException(const char* func_name, const char* message = NULL);
+ DataSpaceIException(const string func_name, const string message = DEFAULT_MSG);
virtual ~DataSpaceIException();
};
class H5_DLLCPP DataTypeIException : public Exception {
public:
DataTypeIException();
- DataTypeIException(const string& func_name, const string& message = NULL);
- DataTypeIException(const char* func_name, const char* message = NULL);
+ DataTypeIException(const string func_name, const string message = DEFAULT_MSG);
virtual ~DataTypeIException();
};
class H5_DLLCPP PropListIException : public Exception {
public:
PropListIException();
- PropListIException(const string& func_name, const string& message=NULL);
- PropListIException(const char* func_name, const char* message = NULL);
+ PropListIException(const string func_name, const string message = DEFAULT_MSG);
virtual ~PropListIException();
};
class H5_DLLCPP DataSetIException : public Exception {
public:
DataSetIException();
- DataSetIException(const string& func_name, const string& message=NULL);
- DataSetIException(const char* func_name, const char* message = NULL);
+ DataSetIException(const string func_name, const string message = DEFAULT_MSG);
virtual ~DataSetIException();
};
class H5_DLLCPP AttributeIException : public Exception {
public:
AttributeIException();
- AttributeIException(const string& func_name, const string& message=NULL);
- AttributeIException(const char* func_name, const char* message = NULL);
+ AttributeIException(const string func_name, const string message = DEFAULT_MSG);
virtual ~AttributeIException();
};
class H5_DLLCPP ReferenceException : public Exception {
public:
ReferenceException();
- ReferenceException(const string& func_name, const string& message=NULL);
- ReferenceException(const char* func_name, const char* message = NULL);
+ ReferenceException(const string func_name, const string message=DEFAULT_MSG);
virtual ~ReferenceException();
};
class H5_DLLCPP LibraryIException : public Exception {
public:
LibraryIException();
- LibraryIException(const string& func_name, const string& message=NULL);
- LibraryIException(const char* func_name, const char* message = NULL);
+ LibraryIException(const string func_name, const string message=DEFAULT_MSG);
virtual ~LibraryIException();
};
class H5_DLLCPP IdComponentException : public Exception {
public:
IdComponentException();
- IdComponentException(const string& func_name, const string& message=NULL);
- IdComponentException(const char* func_name, const char* message = NULL);
+ IdComponentException(const string func_name, const string message=DEFAULT_MSG);
virtual ~IdComponentException();
};