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@686
|
23 #include "Debug.h"
|
Chris@686
|
24
|
Chris@130
|
25 class FileNotFound : virtual public std::exception
|
Chris@130
|
26 {
|
Chris@130
|
27 public:
|
Chris@130
|
28 FileNotFound(QString file) throw();
|
Chris@130
|
29 virtual ~FileNotFound() throw() { }
|
Chris@130
|
30 virtual const char *what() const throw();
|
Chris@130
|
31
|
Chris@130
|
32 protected:
|
Chris@130
|
33 QString m_file;
|
Chris@130
|
34 };
|
Chris@130
|
35
|
Chris@130
|
36 class FailedToOpenFile : virtual public std::exception
|
Chris@130
|
37 {
|
Chris@130
|
38 public:
|
Chris@130
|
39 FailedToOpenFile(QString file) throw();
|
Chris@130
|
40 virtual ~FailedToOpenFile() throw() { }
|
Chris@130
|
41 virtual const char *what() const throw();
|
Chris@130
|
42
|
Chris@130
|
43 protected:
|
Chris@130
|
44 QString m_file;
|
Chris@130
|
45 };
|
Chris@130
|
46
|
Chris@130
|
47 class DirectoryCreationFailed : virtual public std::exception
|
Chris@130
|
48 {
|
Chris@130
|
49 public:
|
Chris@130
|
50 DirectoryCreationFailed(QString directory) throw();
|
Chris@130
|
51 virtual ~DirectoryCreationFailed() throw() { }
|
Chris@130
|
52 virtual const char *what() const throw();
|
Chris@130
|
53
|
Chris@130
|
54 protected:
|
Chris@130
|
55 QString m_directory;
|
Chris@130
|
56 };
|
Chris@130
|
57
|
Chris@130
|
58 class FileReadFailed : virtual public std::exception
|
Chris@130
|
59 {
|
Chris@130
|
60 public:
|
Chris@130
|
61 FileReadFailed(QString file) throw();
|
Chris@130
|
62 virtual ~FileReadFailed() throw() { }
|
Chris@130
|
63 virtual const char *what() const throw();
|
Chris@130
|
64
|
Chris@130
|
65 protected:
|
Chris@130
|
66 QString m_file;
|
Chris@130
|
67 };
|
Chris@130
|
68
|
Chris@130
|
69 class FileOperationFailed : virtual public std::exception
|
Chris@130
|
70 {
|
Chris@130
|
71 public:
|
Chris@130
|
72 FileOperationFailed(QString file, QString operation) throw();
|
Chris@130
|
73 virtual ~FileOperationFailed() throw() { }
|
Chris@130
|
74 virtual const char *what() const throw();
|
Chris@130
|
75
|
Chris@130
|
76 protected:
|
Chris@130
|
77 QString m_file;
|
Chris@130
|
78 QString m_operation;
|
Chris@130
|
79 };
|
Chris@130
|
80
|
Chris@130
|
81 class InsufficientDiscSpace : virtual public std::exception
|
Chris@130
|
82 {
|
Chris@130
|
83 public:
|
Chris@130
|
84 InsufficientDiscSpace(QString directory,
|
Chris@928
|
85 int required, int available) throw();
|
Chris@544
|
86 InsufficientDiscSpace(QString directory) throw();
|
Chris@130
|
87 virtual ~InsufficientDiscSpace() throw() { }
|
Chris@130
|
88 virtual const char *what() const throw();
|
Chris@130
|
89
|
Chris@544
|
90 QString getDirectory() const { return m_directory; }
|
Chris@928
|
91 int getRequired() const { return m_required; }
|
Chris@928
|
92 int getAvailable() const { return m_available; }
|
Chris@130
|
93
|
Chris@130
|
94 protected:
|
Chris@130
|
95 QString m_directory;
|
Chris@928
|
96 int m_required;
|
Chris@928
|
97 int m_available;
|
Chris@130
|
98 };
|
Chris@130
|
99
|
Chris@387
|
100 class AllocationFailed : virtual public std::exception
|
Chris@387
|
101 {
|
Chris@387
|
102 public:
|
Chris@387
|
103 AllocationFailed(QString purpose) throw();
|
Chris@387
|
104 virtual ~AllocationFailed() throw() { }
|
Chris@387
|
105 virtual const char *what() const throw();
|
Chris@387
|
106
|
Chris@387
|
107 protected:
|
Chris@387
|
108 QString m_purpose;
|
Chris@387
|
109 };
|
Chris@387
|
110
|
Chris@130
|
111 #endif
|