annotate base/Exceptions.h @ 661:a4faa1840384

* If a FileSource URL won't convert at all in strict mode, try again in tolerant mode (necessary for e.g. filenames with square brackets in them)
author Chris Cannam
date Tue, 19 Oct 2010 21:47:55 +0100
parents 65d955c4d671
children b4a8d8221eaf
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@544 84 InsufficientDiscSpace(QString directory) throw();
Chris@130 85 virtual ~InsufficientDiscSpace() throw() { }
Chris@130 86 virtual const char *what() const throw();
Chris@130 87
Chris@544 88 QString getDirectory() const { return m_directory; }
Chris@130 89 size_t getRequired() const { return m_required; }
Chris@130 90 size_t getAvailable() const { return m_available; }
Chris@130 91
Chris@130 92 protected:
Chris@130 93 QString m_directory;
Chris@130 94 size_t m_required;
Chris@130 95 size_t m_available;
Chris@130 96 };
Chris@130 97
Chris@387 98 class AllocationFailed : virtual public std::exception
Chris@387 99 {
Chris@387 100 public:
Chris@387 101 AllocationFailed(QString purpose) throw();
Chris@387 102 virtual ~AllocationFailed() throw() { }
Chris@387 103 virtual const char *what() const throw();
Chris@387 104
Chris@387 105 protected:
Chris@387 106 QString m_purpose;
Chris@387 107 };
Chris@387 108
Chris@130 109 #endif