#include "exception.hxx"
+
#include <stdio.h>
#include <cstring>
#include <sstream>
-using std::string;
-\f
+#include <simgear/misc/sg_path.hxx>
+
////////////////////////////////////////////////////////////////////////
// Implementation of sg_location class.
////////////////////////////////////////////////////////////////////////
_path[0] = '\0';
}
-sg_location::sg_location (const string& path, int line, int column)
+sg_location::sg_location (const std::string& path, int line, int column)
: _line(line),
_column(column),
_byte(-1)
_byte = byte;
}
-string
+std::string
sg_location::asString () const
{
std::ostringstream out;
return _message;
}
-const string
+const std::string
sg_throwable::getFormattedMessage () const
{
- return string(getMessage());
+ return std::string(getMessage());
}
void
{
}
-sg_error::sg_error (const string& message, const string& origin)
+sg_error::sg_error(const std::string& message, const std::string& origin)
: sg_throwable(message.c_str(), origin.c_str())
{
}
sg_error::~sg_error () throw ()
{
}
-\f
+
////////////////////////////////////////////////////////////////////////
// Implementation of sg_exception class.
////////////////////////////////////////////////////////////////////////
{
}
-sg_exception::sg_exception (const string& message, const string& origin)
+sg_exception::sg_exception( const std::string& message,
+ const std::string& origin )
: sg_throwable(message.c_str(), origin.c_str())
{
}
sg_exception::~sg_exception () throw ()
{
}
-\f
+
////////////////////////////////////////////////////////////////////////
// Implementation of sg_io_exception.
////////////////////////////////////////////////////////////////////////
{
}
-sg_io_exception::sg_io_exception (const string& message, const string& origin)
+sg_io_exception::sg_io_exception( const std::string& message,
+ const std::string& origin )
: sg_exception(message, origin)
{
}
+sg_io_exception::sg_io_exception( const std::string& message,
+ const sg_location &location,
+ const std::string& origin )
+ : sg_exception(message, origin),
+ _location(location)
+{
+}
+
+sg_io_exception::sg_io_exception( const std::string &message,
+ const SGPath& origin )
+ : sg_exception(message, origin.str())
+{
+
+}
+
sg_io_exception::~sg_io_exception () throw ()
{
}
-const string
+const std::string
sg_io_exception::getFormattedMessage () const
{
- string ret = getMessage();
- string loc = getLocation().asString();
+ std::string ret = getMessage();
+ std::string loc = getLocation().asString();
if (loc.length()) {
ret += "\n at ";
ret += loc;
setText(text);
}
-sg_format_exception::sg_format_exception (const string& message,
- const string& text,
- const string& origin)
+sg_format_exception::sg_format_exception( const std::string& message,
+ const std::string& text,
+ const std::string& origin )
: sg_exception(message, origin)
{
setText(text.c_str());
{
}
-sg_range_exception::sg_range_exception(const string& message,
- const string& origin)
+sg_range_exception::sg_range_exception(const std::string& message,
+ const std::string& origin)
: sg_exception(message, origin)
{
}