summaryrefslogtreecommitdiff
path: root/include/exception.h
diff options
context:
space:
mode:
authorJasperVanEck <jaspergkurtz@gmail.com>2013-11-29 10:53:22 +0100
committerJasperVanEck <jaspergkurtz@gmail.com>2013-11-29 10:53:22 +0100
commitdf717775f6e484cd8901e01d5a355f1683fbeb64 (patch)
tree80efdd5c54fd79812c285019482956997bcb4379 /include/exception.h
parentf22a2c5f26eba8f4e907e8919c56b67038c95354 (diff)
Partial Exception implementation added, inherits from std::exception
Diffstat (limited to 'include/exception.h')
-rw-r--r--include/exception.h28
1 files changed, 16 insertions, 12 deletions
diff --git a/include/exception.h b/include/exception.h
index ea328fe..f787582 100644
--- a/include/exception.h
+++ b/include/exception.h
@@ -5,6 +5,7 @@
* @author Jasper van Eck <jasper.vaneck@copernica.com>
* @copyright 2013 Copernica BV
*/
+#include <exception>
/**
* Set up namespace
@@ -14,41 +15,44 @@ namespace Php {
/**
* Class definition
*/
-class Exception
+class Exception : public std::exception
{
private:
/**
* The exception message
- * @var char*
+ * @var char*
*/
- char* _message;
+ std::string _message;
public:
/**
* Constructor
- * @param string The exception message.
+ * @param &string
*/
- Exception(char* message) throw()
+ Exception(const std::string &message) : std::exception(), _message(message)
{
- _message = message;
}
-
+
/**
- * Destructor
+ * Destructor
*/
- ~Exception() throw()
+ virtual ~Exception()
{
}
/**
* Returns the message of the exception.
- * @return std::string
+ * @return &string
*/
- char* getMessage() const throw()
+ std::string &message() throw()
{
return _message;
}
-
};
+/**
+ * End of namespace
+ */
}
+
+