annotate base/Exceptions.h @ 319:3ff8f571da09

* Hoist alignment model set/query up to Model, so any models can be aligned * Add Model::aboutToDelete and aboutToBeDeleted for management of models that are contained by or referred to by other models instead of only the document
author Chris Cannam
date Wed, 24 Oct 2007 15:21:38 +0000
parents b290c43f01ec
children 7aa1de571880
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@130 96 #endif