From 445cd4ccda9fefbd89cc315411b52d545c419506 Mon Sep 17 00:00:00 2001 From: curt Date: Tue, 24 Jul 2001 21:40:46 +0000 Subject: [PATCH] - remove clone method declarations (SGI/Irix compiler bugs) - added default implementation for sg_throwable::getFormattedMessage (returns sg_throwable::getMessage by default) - removed unneeded newline in sg_location::asString --- simgear/misc/exception.cxx | 56 +++++++++++--------------------------- 1 file changed, 16 insertions(+), 40 deletions(-) diff --git a/simgear/misc/exception.cxx b/simgear/misc/exception.cxx index 4c263de5..f67bc352 100644 --- a/simgear/misc/exception.cxx +++ b/simgear/misc/exception.cxx @@ -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()); -} - - - //////////////////////////////////////////////////////////////////////// // 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()); -} - //////////////////////////////////////////////////////////////////////// @@ -205,12 +197,6 @@ sg_exception::~sg_exception () { } -sg_exception * -sg_exception::clone () const -{ - return new sg_exception(getMessage(), getOrigin()); -} - //////////////////////////////////////////////////////////////////////// @@ -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()); -} - - //////////////////////////////////////////////////////////////////////// @@ -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()); -} - //////////////////////////////////////////////////////////////////////// @@ -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 -- 2.39.5