X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=simgear%2Fmisc%2Fexception.cxx;h=75f4cf50d0368853b48c7ea2bd9d63a400556caf;hb=5bab565cfe4c30d6cf08ecaba50af74d5e4f0c98;hp=4c263de5bf9d3a87d91fb1b4f39cd113e805b64d;hpb=a9cd67e0ce302c2319739f2684c2bd7c67f2c24d;p=simgear.git diff --git a/simgear/misc/exception.cxx b/simgear/misc/exception.cxx index 4c263de5..75f4cf50 100644 --- a/simgear/misc/exception.cxx +++ b/simgear/misc/exception.cxx @@ -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()); -} - - - //////////////////////////////////////////////////////////////////////// // 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