Exceptions.h

Go to the documentation of this file.
00001 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*-  vi:set ts=8 sts=4 sw=4: */
00002 
00003 /*
00004     Sonic Visualiser
00005     An audio file viewer and annotation editor.
00006     Centre for Digital Music, Queen Mary, University of London.
00007     This file copyright 2006 Chris Cannam.
00008     
00009     This program is free software; you can redistribute it and/or
00010     modify it under the terms of the GNU General Public License as
00011     published by the Free Software Foundation; either version 2 of the
00012     License, or (at your option) any later version.  See the file
00013     COPYING included with this distribution for more information.
00014 */
00015 
00016 #ifndef _EXCEPTIONS_H_
00017 #define _EXCEPTIONS_H_
00018 
00019 #include <exception>
00020 
00021 #include <QString>
00022 
00023 class FileNotFound : virtual public std::exception
00024 {
00025 public:
00026     FileNotFound(QString file) throw();
00027     virtual ~FileNotFound() throw() { }
00028     virtual const char *what() const throw();
00029     
00030 protected:
00031     QString m_file;
00032 };
00033 
00034 class FailedToOpenFile : virtual public std::exception
00035 {
00036 public:
00037     FailedToOpenFile(QString file) throw();
00038     virtual ~FailedToOpenFile() throw() { }
00039     virtual const char *what() const throw();
00040     
00041 protected:
00042     QString m_file;
00043 };
00044 
00045 class DirectoryCreationFailed : virtual public std::exception
00046 {
00047 public:
00048     DirectoryCreationFailed(QString directory) throw();
00049     virtual ~DirectoryCreationFailed() throw() { }
00050     virtual const char *what() const throw();
00051     
00052 protected:
00053     QString m_directory;
00054 };
00055 
00056 class FileReadFailed : virtual public std::exception
00057 {
00058 public:
00059     FileReadFailed(QString file) throw();
00060     virtual ~FileReadFailed() throw() { }
00061     virtual const char *what() const throw();
00062 
00063 protected:
00064     QString m_file;
00065 };
00066 
00067 class FileOperationFailed : virtual public std::exception
00068 {
00069 public:
00070     FileOperationFailed(QString file, QString operation) throw();
00071     virtual ~FileOperationFailed() throw() { }
00072     virtual const char *what() const throw();
00073 
00074 protected:
00075     QString m_file;
00076     QString m_operation;
00077 };
00078 
00079 class InsufficientDiscSpace : virtual public std::exception
00080 {
00081 public:
00082     InsufficientDiscSpace(QString directory,
00083                           size_t required, size_t available) throw();
00084     virtual ~InsufficientDiscSpace() throw() { }
00085     virtual const char *what() const throw();
00086 
00087     size_t getRequired() const { return m_required; }
00088     size_t getAvailable() const { return m_available; }
00089 
00090 protected:
00091     QString m_directory;
00092     size_t m_required;
00093     size_t m_available;
00094 };
00095 
00096 #endif

Generated on Wed Feb 20 15:45:25 2008 for SonicVisualiser by  doxygen 1.5.1