]> git.mxchange.org Git - simgear.git/blobdiff - simgear/structure/exception.cxx
Fix for libCurl pipelining and connection count.
[simgear.git] / simgear / structure / exception.cxx
index accd9706c264dc19f2e8d9dd836c7ce9444b10f2..cac9cc950e515e68ab57e1563084d1c9727743ec 100644 (file)
@@ -6,12 +6,13 @@
 
 
 #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.
 ////////////////////////////////////////////////////////////////////////
@@ -24,7 +25,7 @@ sg_location::sg_location ()
     _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)
@@ -97,7 +98,7 @@ sg_location::setByte (int byte)
   _byte = byte;
 }
 
-string
+std::string
 sg_location::asString () const
 {
   std::ostringstream out;
@@ -145,10 +146,10 @@ sg_throwable::getMessage () const
   return _message;
 }
 
-const string
+const std::string
 sg_throwable::getFormattedMessage () const
 {
-  return string(getMessage());
+  return std::string(getMessage());
 }
 
 void
@@ -201,7 +202,7 @@ sg_error::sg_error (const char* message, const char *origin)
 {
 }
 
-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())
 {
 }
@@ -209,7 +210,7 @@ sg_error::sg_error (const string& message, const string& origin)
 sg_error::~sg_error () throw ()
 {
 }
-\f
+
 ////////////////////////////////////////////////////////////////////////
 // Implementation of sg_exception class.
 ////////////////////////////////////////////////////////////////////////
@@ -224,7 +225,8 @@ sg_exception::sg_exception (const char* message, const char* origin)
 {
 }
 
-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())
 {
 }
@@ -232,7 +234,7 @@ sg_exception::sg_exception (const string& message, const string& origin)
 sg_exception::~sg_exception () throw ()
 {
 }
-\f
+
 ////////////////////////////////////////////////////////////////////////
 // Implementation of sg_io_exception.
 ////////////////////////////////////////////////////////////////////////
@@ -255,20 +257,36 @@ sg_io_exception::sg_io_exception (const char* message,
 {
 }
 
-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;
@@ -308,9 +326,9 @@ sg_format_exception::sg_format_exception (const char* message,
   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());
@@ -354,8 +372,8 @@ sg_range_exception::sg_range_exception (const char* message,
 {
 }
 
-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)
 {
 }