Mercurial > hg > svcore
comparison base/Exceptions.h @ 1586:841b2a3e606d
Merge from branch fix-static-analysis
| author | Chris Cannam |
|---|---|
| date | Wed, 09 Jan 2019 15:24:38 +0000 |
| parents | c01cbe41aeb5 |
| children |
comparison
equal
deleted
inserted
replaced
| 1585:9570ef94eaa3 | 1586:841b2a3e606d |
|---|---|
| 11 published by the Free Software Foundation; either version 2 of the | 11 published by the Free Software Foundation; either version 2 of the |
| 12 License, or (at your option) any later version. See the file | 12 License, or (at your option) any later version. See the file |
| 13 COPYING included with this distribution for more information. | 13 COPYING included with this distribution for more information. |
| 14 */ | 14 */ |
| 15 | 15 |
| 16 #ifndef _EXCEPTIONS_H_ | 16 #ifndef SV_EXCEPTIONS_H |
| 17 #define _EXCEPTIONS_H_ | 17 #define SV_EXCEPTIONS_H |
| 18 | 18 |
| 19 #include <exception> | 19 #include <exception> |
| 20 | 20 |
| 21 #include <QString> | 21 #include <QString> |
| 22 | 22 |
| 25 class FileNotFound : virtual public std::exception | 25 class FileNotFound : virtual public std::exception |
| 26 { | 26 { |
| 27 public: | 27 public: |
| 28 FileNotFound(QString file) throw(); | 28 FileNotFound(QString file) throw(); |
| 29 virtual ~FileNotFound() throw() { } | 29 virtual ~FileNotFound() throw() { } |
| 30 virtual const char *what() const throw(); | 30 const char *what() const throw() override; |
| 31 | 31 |
| 32 protected: | 32 protected: |
| 33 QString m_file; | 33 QString m_file; |
| 34 }; | 34 }; |
| 35 | 35 |
| 36 class FailedToOpenFile : virtual public std::exception | 36 class FailedToOpenFile : virtual public std::exception |
| 37 { | 37 { |
| 38 public: | 38 public: |
| 39 FailedToOpenFile(QString file) throw(); | 39 FailedToOpenFile(QString file) throw(); |
| 40 virtual ~FailedToOpenFile() throw() { } | 40 virtual ~FailedToOpenFile() throw() { } |
| 41 virtual const char *what() const throw(); | 41 const char *what() const throw() override; |
| 42 | 42 |
| 43 protected: | 43 protected: |
| 44 QString m_file; | 44 QString m_file; |
| 45 }; | 45 }; |
| 46 | 46 |
| 47 class DirectoryCreationFailed : virtual public std::exception | 47 class DirectoryCreationFailed : virtual public std::exception |
| 48 { | 48 { |
| 49 public: | 49 public: |
| 50 DirectoryCreationFailed(QString directory) throw(); | 50 DirectoryCreationFailed(QString directory) throw(); |
| 51 virtual ~DirectoryCreationFailed() throw() { } | 51 virtual ~DirectoryCreationFailed() throw() { } |
| 52 virtual const char *what() const throw(); | 52 const char *what() const throw() override; |
| 53 | 53 |
| 54 protected: | 54 protected: |
| 55 QString m_directory; | 55 QString m_directory; |
| 56 }; | 56 }; |
| 57 | 57 |
| 58 class FileReadFailed : virtual public std::exception | 58 class FileReadFailed : virtual public std::exception |
| 59 { | 59 { |
| 60 public: | 60 public: |
| 61 FileReadFailed(QString file) throw(); | 61 FileReadFailed(QString file) throw(); |
| 62 virtual ~FileReadFailed() throw() { } | 62 virtual ~FileReadFailed() throw() { } |
| 63 virtual const char *what() const throw(); | 63 const char *what() const throw() override; |
| 64 | 64 |
| 65 protected: | 65 protected: |
| 66 QString m_file; | 66 QString m_file; |
| 67 }; | 67 }; |
| 68 | 68 |
| 69 class FileOperationFailed : virtual public std::exception | 69 class FileOperationFailed : virtual public std::exception |
| 70 { | 70 { |
| 71 public: | 71 public: |
| 72 FileOperationFailed(QString file, QString operation) throw(); | 72 FileOperationFailed(QString file, QString operation) throw(); |
| 73 virtual ~FileOperationFailed() throw() { } | 73 virtual ~FileOperationFailed() throw() { } |
| 74 virtual const char *what() const throw(); | 74 const char *what() const throw() override; |
| 75 | 75 |
| 76 protected: | 76 protected: |
| 77 QString m_file; | 77 QString m_file; |
| 78 QString m_operation; | 78 QString m_operation; |
| 79 }; | 79 }; |
| 83 public: | 83 public: |
| 84 InsufficientDiscSpace(QString directory, | 84 InsufficientDiscSpace(QString directory, |
| 85 size_t required, size_t available) throw(); | 85 size_t required, size_t available) throw(); |
| 86 InsufficientDiscSpace(QString directory) throw(); | 86 InsufficientDiscSpace(QString directory) throw(); |
| 87 virtual ~InsufficientDiscSpace() throw() { } | 87 virtual ~InsufficientDiscSpace() throw() { } |
| 88 virtual const char *what() const throw(); | 88 const char *what() const throw() override; |
| 89 | 89 |
| 90 QString getDirectory() const { return m_directory; } | 90 QString getDirectory() const { return m_directory; } |
| 91 size_t getRequired() const { return m_required; } | 91 size_t getRequired() const { return m_required; } |
| 92 size_t getAvailable() const { return m_available; } | 92 size_t getAvailable() const { return m_available; } |
| 93 | 93 |
| 100 class AllocationFailed : virtual public std::exception | 100 class AllocationFailed : virtual public std::exception |
| 101 { | 101 { |
| 102 public: | 102 public: |
| 103 AllocationFailed(QString purpose) throw(); | 103 AllocationFailed(QString purpose) throw(); |
| 104 virtual ~AllocationFailed() throw() { } | 104 virtual ~AllocationFailed() throw() { } |
| 105 virtual const char *what() const throw(); | 105 const char *what() const throw() override; |
| 106 | 106 |
| 107 protected: | 107 protected: |
| 108 QString m_purpose; | 108 QString m_purpose; |
| 109 }; | 109 }; |
| 110 | 110 |
