Replace reference to std::exception
authorScott Cantor <cantor.2@osu.edu>
Sun, 19 Feb 2006 05:29:54 +0000 (05:29 +0000)
committerScott Cantor <cantor.2@osu.edu>
Sun, 19 Feb 2006 05:29:54 +0000 (05:29 +0000)
xmltooling/exceptions.h

index ed9343a..a5d7727 100644 (file)
 #define __xmltooling_exceptions_h__\r
 \r
 #include <string>\r
-#include <exception>\r
 #include <xmltooling/base.h>\r
 \r
 #define DECL_XMLTOOLING_EXCEPTION(type) \\r
-    class XMLTOOL_EXCEPTIONAPI(XMLTOOL_API) type : public std::exception { \\r
+    class XMLTOOL_EXCEPTIONAPI(XMLTOOL_API) type : public XMLToolingException { \\r
     public: \\r
-        type(const char* msg) : std::exception(msg) {} \\r
-        type(std::string& msg) : std::exception(msg.c_str()) {} \\r
+        type(const char* msg) : XMLToolingException(msg) {} \\r
+        type(std::string& msg) : XMLToolingException(msg) {} \\r
         virtual ~type() {} \\r
     }\r
 \r
 namespace xmltooling {\r
     \r
+    /**\r
+     * Base exception class.\r
+     * std::exception seems to be inconsistently defined, so this is just\r
+     * a substitute base class.\r
+     */\r
+    class XMLTOOL_EXCEPTIONAPI(XMLTOOL_API) XMLToolingException\r
+    {\r
+    public:\r
+        XMLToolingException() {}\r
+        virtual ~XMLToolingException() {}\r
+        XMLToolingException(const char* const msg) : m_msg(msg) {}\r
+        XMLToolingException(const std::string& msg) : m_msg(msg) {}\r
+        virtual const char* what() const { return m_msg.c_str(); }\r
+    private:\r
+        std::string m_msg;\r
+    };\r
+\r
     DECL_XMLTOOLING_EXCEPTION(XMLParserException);\r
 \r
 };\r