annotate base/Exceptions.h @ 434:5a13b76cd034

...
author Chris Cannam
date Wed, 02 Jul 2008 13:31:37 +0000
parents 7aa1de571880
children 65d955c4d671
rev   line source
Chris@130 1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
Chris@130 2
Chris@130 3 /*
Chris@130 4 Sonic Visualiser
Chris@130 5 An audio file viewer and annotation editor.
Chris@130 6 Centre for Digital Music, Queen Mary, University of London.
Chris@130 7 This file copyright 2006 Chris Cannam.
Chris@130 8
Chris@130 9 This program is free software; you can redistribute it and/or
Chris@130 10 modify it under the terms of the GNU General Public License as
Chris@130 11 published by the Free Software Foundation; either version 2 of the
Chris@130 12 License, or (at your option) any later version. See the file
Chris@130 13 COPYING included with this distribution for more information.
Chris@130 14 */
Chris@130 15
Chris@130 16 #ifndef _EXCEPTIONS_H_
Chris@130 17 #define _EXCEPTIONS_H_
Chris@130 18
Chris@130 19 #include <exception>
Chris@130 20
Chris@130 21 #include <QString>
Chris@130 22
Chris@130 23 class FileNotFound : virtual public std::exception
Chris@130 24 {
Chris@130 25 public:
Chris@130 26 FileNotFound(QString file) throw();
Chris@130 27 virtual ~FileNotFound() throw() { }
Chris@130 28 virtual const char *what() const throw();
Chris@130 29
Chris@130 30 protected:
Chris@130 31 QString m_file;
Chris@130 32 };
Chris@130 33
Chris@130 34 class FailedToOpenFile : virtual public std::exception
Chris@130 35 {
Chris@130 36 public:
Chris@130 37 FailedToOpenFile(QString file) throw();
Chris@130 38 virtual ~FailedToOpenFile() throw() { }
Chris@130 39 virtual const char *what() const throw();
Chris@130 40
Chris@130 41 protected:
Chris@130 42 QString m_file;
Chris@130 43 };
Chris@130 44
Chris@130 45 class DirectoryCreationFailed : virtual public std::exception
Chris@130 46 {
Chris@130 47 public:
Chris@130 48 DirectoryCreationFailed(QString directory) throw();
Chris@130 49 virtual ~DirectoryCreationFailed() throw() { }
Chris@130 50 virtual const char *what() const throw();
Chris@130 51
Chris@130 52 protected:
Chris@130 53 QString m_directory;
Chris@130 54 };
Chris@130 55
Chris@130 56 class FileReadFailed : virtual public std::exception
Chris@130 57 {
Chris@130 58 public:
Chris@130 59 FileReadFailed(QString file) throw();
Chris@130 60 virtual ~FileReadFailed() throw() { }
Chris@130 61 virtual const char *what() const throw();
Chris@130 62
Chris@130 63 protected:
Chris@130 64 QString m_file;
Chris@130 65 };
Chris@130 66
Chris@130 67 class FileOperationFailed : virtual public std::exception
Chris@130 68 {
Chris@130 69 public:
Chris@130 70 FileOperationFailed(QString file, QString operation) throw();
Chris@130 71 virtual ~FileOperationFailed() throw() { }
Chris@130 72 virtual const char *what() const throw();
Chris@130 73
Chris@130 74 protected:
Chris@130 75 QString m_file;
Chris@130 76 QString m_operation;
Chris@130 77 };
Chris@130 78
Chris@130 79 class InsufficientDiscSpace : virtual public std::exception
Chris@130 80 {
Chris@130 81 public:
Chris@130 82 InsufficientDiscSpace(QString directory,
Chris@130 83 size_t required, size_t available) throw();
Chris@130 84 virtual ~InsufficientDiscSpace() throw() { }
Chris@130 85 virtual const char *what() const throw();
Chris@130 86
Chris@130 87 size_t getRequired() const { return m_required; }
Chris@130 88 size_t getAvailable() const { return m_available; }
Chris@130 89
Chris@130 90 protected:
Chris@130 91 QString m_directory;
Chris@130 92 size_t m_required;
Chris@130 93 size_t m_available;
Chris@130 94 };
Chris@130 95
Chris@387 96 class AllocationFailed : virtual public std::exception
Chris@387 97 {
Chris@387 98 public:
Chris@387 99 AllocationFailed(QString purpose) throw();
Chris@387 100 virtual ~AllocationFailed() throw() { }
Chris@387 101 virtual const char *what() const throw();
Chris@387 102
Chris@387 103 protected:
Chris@387 104 QString m_purpose;
Chris@387 105 };
Chris@387 106
Chris@130 107 #endif