summaryrefslogtreecommitdiffstats
path: root/crypt
diff options
context:
space:
mode:
Diffstat (limited to 'crypt')
-rw-r--r--crypt/cryptexception.cpp23
-rw-r--r--crypt/cryptexception.h43
2 files changed, 66 insertions, 0 deletions
diff --git a/crypt/cryptexception.cpp b/crypt/cryptexception.cpp
new file mode 100644
index 0000000..4cf2e6c
--- /dev/null
+++ b/crypt/cryptexception.cpp
@@ -0,0 +1,23 @@
+#include "cryptexception.h"
+
+CryptException::CryptException(std::string what, int returnCode)
+ :exception()
+{
+ this->whatMsg = what;
+ this->retId = returnCode;
+}
+
+CryptException::~CryptException() throw()
+{
+
+}
+
+const char *CryptException::what() const throw()
+{
+ return whatMsg.c_str();
+}
+
+int CryptException::returnCode() const
+{
+ return retId;
+}
diff --git a/crypt/cryptexception.h b/crypt/cryptexception.h
new file mode 100644
index 0000000..1141969
--- /dev/null
+++ b/crypt/cryptexception.h
@@ -0,0 +1,43 @@
+#ifndef CRYPTEXCEPTION_H
+#define CRYPTEXCEPTION_H
+
+#include <exception>
+#include <QString>
+
+class CryptException : public std::exception
+{
+public:
+ /**
+ * @brief CryptException
+ * Erzeugt eine Exception mit den angegebenen Werten.
+ * @param what Die Fehlermeldung, die dem Nutzer gezeigt wird.
+ * @param returnCode Der Rückgabewert für die Konsole.
+ */
+ CryptException(std::string what, int returnCode);
+
+ /**
+ * @brief ~CryptException
+ */
+ virtual ~CryptException() throw();
+
+ /**
+ * @brief what
+ * Gibt die Fehlermelung für den Nutzer zurück.
+ * @return Die Fehlermeldung für den Nutzer.
+ */
+ virtual const char *what() const throw();
+
+ /**
+ * @brief returnCode
+ * Gibt den Konsolenrückgabewert zurück.
+ * @return Der Rückgabewert für die Konsole.
+ */
+ int returnCode() const;
+
+private:
+ std::string whatMsg;
+ int retId;
+
+};
+
+#endif // CRYPTEXCEPTION_H