Преглед на файлове

Reverting to one only exception

Eiyeron Fulmincendii преди 10 години
родител
ревизия
34c6bcd8c4
променени са 3 файла, в които са добавени 12 реда и са изтрити 27 реда
  1. 2 2
      src/piaf/Archive.cpp
  2. 8 16
      src/piaf/Archive.h
  3. 2 9
      src/piaf/Exceptions.cpp

+ 2 - 2
src/piaf/Archive.cpp

@@ -15,7 +15,7 @@ using WalrusRPG::PIAF::Archive;
 using WalrusRPG::PIAF::File;
 using WalrusRPG::PIAF::FileType;
 using WalrusRPG::PIAF::CompressionType;
-using namespace WalrusRPG::PIAF::Exceptions;
+using namespace WalrusRPG::PIAF;
 
 #if NSPIRE
 using namespace Nspire;
@@ -88,7 +88,7 @@ Archive::Archive(const char *filepath)
     {
         // TODO : throw Couldn't open
         // fprintf(stderr, "Unable to open %s\n", filepath);
-        throw PIAF::Exceptions::FileNotFound(__FILE__, __LINE__, (const char*)filepath);
+        throw PIAF::PIAFException(__FILE__, __LINE__, (const char*)filepath);
     }
 
     // Loading stuff happens NOW

+ 8 - 16
src/piaf/Archive.h

@@ -69,26 +69,18 @@ namespace WalrusRPG
             File get(const char *filename);
         };
 
-        namespace Exceptions
+        class PIAFException : public std::exception
         {
-            class PIAFException : public std::exception
-            {
-                private:
-                    char *msg;
+            private:
+                char *msg;
 
-                public:
-                PIAFException(const char *file, const unsigned line, const char *message);
-                virtual ~PIAFException();
+            public:
+            PIAFException(const char *file, const unsigned line, const char *message);
+            virtual ~PIAFException();
 
-                const char* what() const throw();
-            };
+            const char* what() const throw();
+        };
 
-            class FileNotFound : public PIAFException
-            {
-                public:
-                 FileNotFound(const char *file, const unsigned line, const char *message);
-            };
-        }
     }
 }
 

+ 2 - 9
src/piaf/Exceptions.cpp

@@ -2,8 +2,7 @@
 #include <cmath>
 #include <cstring>
 
-using WalrusRPG::PIAF::Exceptions::PIAFException;
-using WalrusRPG::PIAF::Exceptions::FileNotFound;
+using WalrusRPG::PIAF::PIAFException;
 using namespace WalrusRPG::PIAF;
 
 PIAFException::PIAFException(const char *file, const unsigned line, const char *message)
@@ -29,10 +28,4 @@ PIAFException::~PIAFException()
 const char* PIAFException::what() const throw()
 {
 	return msg;
-}
-
-FileNotFound::FileNotFound(const char *file, const unsigned line, const char *message)
-: PIAFException(file, line, message)
-{
-
-}
+}