|
From: <bo...@us...> - 2008-11-15 04:44:07
|
Revision: 364
http://gearbox.svn.sourceforge.net/gearbox/?rev=364&view=rev
Author: borax00
Date: 2008-11-15 04:43:57 +0000 (Sat, 15 Nov 2008)
Log Message:
-----------
Minor simplifications. Functionality unchanged.
Modified Paths:
--------------
gearbox/trunk/src/gbxutilacfr/exceptions.cpp
gearbox/trunk/src/gbxutilacfr/exceptions.h
Modified: gearbox/trunk/src/gbxutilacfr/exceptions.cpp
===================================================================
--- gearbox/trunk/src/gbxutilacfr/exceptions.cpp 2008-11-10 05:15:08 UTC (rev 363)
+++ gearbox/trunk/src/gbxutilacfr/exceptions.cpp 2008-11-15 04:43:57 UTC (rev 364)
@@ -16,15 +16,9 @@
namespace gbxutilacfr {
-Exception::Exception( const char *file, const char *line, const char *message )
-{
- setMsg( file, line, message );
-}
-
Exception::Exception( const char *file, const char *line, const std::string &message )
-{
- setMsg( file, line, message.c_str() );
-}
+ : message_(toMessageString(file,line,message))
+{}
Exception::~Exception() throw()
{
@@ -40,16 +34,16 @@
#endif
};
-void
-Exception::setMsg( const char *file, const char *line, const char *message )
+std::string
+Exception::toMessageString( const char *file, const char *line, const std::string &message )
{
- std::string msgString(message);
- message_ = "\n *** ERROR(";
+ std::string msg = "\n *** ERROR(";
// not to confuse our local basename() with gbxutilacfr::basename()
- message_ += this->basename(file);
- message_ += ":";
- message_ += line;
- message_ += "): " + msgString;
+ msg += this->basename(file);
+ msg += ":";
+ msg += line;
+ msg += "): " + message;
+ return msg;
}
} // namespace
Modified: gearbox/trunk/src/gbxutilacfr/exceptions.h
===================================================================
--- gearbox/trunk/src/gbxutilacfr/exceptions.h 2008-11-10 05:15:08 UTC (rev 363)
+++ gearbox/trunk/src/gbxutilacfr/exceptions.h 2008-11-15 04:43:57 UTC (rev 364)
@@ -53,7 +53,6 @@
class Exception : public std::exception
{
public:
- Exception(const char *file, const char *line, const char *message);
Exception(const char *file, const char *line, const std::string &message);
virtual ~Exception() throw();
@@ -61,7 +60,7 @@
virtual const char* what() const throw() { return message_.c_str(); }
protected:
- void setMsg( const char *file, const char *line, const char *message );
+ std::string toMessageString( const char *file, const char *line, const std::string &message );
std::string message_;
@@ -73,8 +72,6 @@
class HardwareException : public gbxutilacfr::Exception
{
public:
- HardwareException(const char *file, const char *line, const char *message)
- : Exception( file, line, message ) {};
HardwareException(const char *file, const char *line, const std::string &message)
: Exception( file, line, message ) {};
};
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|