]> git.mxchange.org Git - simgear.git/blobdiff - simgear/misc/exception.cxx
Updates to build system to better support automake-1.5
[simgear.git] / simgear / misc / exception.cxx
index 4c263de5bf9d3a87d91fb1b4f39cd113e805b64d..75f4cf50d0368853b48c7ea2bd9d63a400556caf 100644 (file)
@@ -86,7 +86,7 @@ sg_location::asString () const
 {
   char buf[128];
   string out = "";
-  if (_path != "") {
+  if (_path != (string)"") {
     out += _path;
     if (_line != -1 || _column != -1)
       out += ",\n";
@@ -95,7 +95,7 @@ sg_location::asString () const
     sprintf(buf, "line %d", _line);
     out += buf;
     if (_column != -1)
-      out += ",\n";
+      out += ", ";
   }
   if (_column != -1) {
     sprintf(buf, "column %d", _column);
@@ -133,6 +133,12 @@ sg_throwable::getMessage () const
   return _message;
 }
 
+const string
+sg_throwable::getFormattedMessage () const
+{
+  return getMessage();
+}
+
 void
 sg_throwable::setMessage (const string &message)
 {
@@ -152,14 +158,6 @@ sg_throwable::setOrigin (const string &origin)
 }
 
 
-sg_throwable *
-sg_throwable::clone () const
-{
-  return new sg_throwable(getMessage(), getOrigin());
-}
-
-
-
 \f
 ////////////////////////////////////////////////////////////////////////
 // Implementation of sg_error class.
@@ -179,12 +177,6 @@ sg_error::~sg_error ()
 {
 }
 
-sg_error *
-sg_error::clone () const
-{
-  return new sg_error(getMessage(), getOrigin());
-}
-
 
 \f
 ////////////////////////////////////////////////////////////////////////
@@ -205,12 +197,6 @@ sg_exception::~sg_exception ()
 {
 }
 
-sg_exception *
-sg_exception::clone () const
-{
-  return new sg_exception(getMessage(), getOrigin());
-}
-
 
 \f
 ////////////////////////////////////////////////////////////////////////
@@ -239,6 +225,15 @@ sg_io_exception::~sg_io_exception ()
 {
 }
 
+const string
+sg_io_exception::getFormattedMessage () const
+{
+  string ret = getMessage();
+  ret += "\n at ";
+  ret += getLocation().asString();
+  return ret;
+}
+
 const sg_location &
 sg_io_exception::getLocation () const
 {
@@ -251,13 +246,6 @@ sg_io_exception::setLocation (const sg_location &location)
   _location = location;
 }
 
-sg_io_exception *
-sg_io_exception::clone () const
-{
-  return new sg_io_exception(getMessage(), getLocation(), getOrigin());
-}
-
-
 
 \f
 ////////////////////////////////////////////////////////////////////////
@@ -294,12 +282,6 @@ sg_format_exception::setText (const string &text)
   _text = text;
 }
 
-sg_format_exception *
-sg_format_exception::clone () const
-{
-  return new sg_format_exception(getMessage(), getText(), getOrigin());
-}
-
 
 \f
 ////////////////////////////////////////////////////////////////////////
@@ -321,11 +303,5 @@ sg_range_exception::~sg_range_exception ()
 {
 }
 
-sg_range_exception *
-sg_range_exception::clone () const
-{
-  return new sg_range_exception(getMessage(), getOrigin());
-}
-
 
 // end of exception.cxx