Mercurial > hg > svcore
comparison base/Exceptions.cpp @ 130:b290c43f01ec
* Exceptions for file read etc
author | Chris Cannam |
---|---|
date | Wed, 28 Jun 2006 15:42:04 +0000 |
parents | |
children | 7aa1de571880 |
comparison
equal
deleted
inserted
replaced
129:4e38a29c13fc | 130:b290c43f01ec |
---|---|
1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */ | |
2 | |
3 /* | |
4 Sonic Visualiser | |
5 An audio file viewer and annotation editor. | |
6 Centre for Digital Music, Queen Mary, University of London. | |
7 This file copyright 2006 Chris Cannam. | |
8 | |
9 This program is free software; you can redistribute it and/or | |
10 modify it under the terms of the GNU General Public License as | |
11 published by the Free Software Foundation; either version 2 of the | |
12 License, or (at your option) any later version. See the file | |
13 COPYING included with this distribution for more information. | |
14 */ | |
15 | |
16 #include "Exceptions.h" | |
17 | |
18 #include <iostream> | |
19 | |
20 FileNotFound::FileNotFound(QString file) throw() : | |
21 m_file(file) | |
22 { | |
23 std::cerr << "ERROR: File not found: " | |
24 << file.toStdString() << std::endl; | |
25 } | |
26 | |
27 const char * | |
28 FileNotFound::what() const throw() | |
29 { | |
30 return QString("File \"%1\" not found") | |
31 .arg(m_file).toLocal8Bit().data(); | |
32 } | |
33 | |
34 FailedToOpenFile::FailedToOpenFile(QString file) throw() : | |
35 m_file(file) | |
36 { | |
37 std::cerr << "ERROR: Failed to open file: " | |
38 << file.toStdString() << std::endl; | |
39 } | |
40 | |
41 const char * | |
42 FailedToOpenFile::what() const throw() | |
43 { | |
44 return QString("Failed to open file \"%1\"") | |
45 .arg(m_file).toLocal8Bit().data(); | |
46 } | |
47 | |
48 DirectoryCreationFailed::DirectoryCreationFailed(QString directory) throw() : | |
49 m_directory(directory) | |
50 { | |
51 std::cerr << "ERROR: Directory creation failed for directory: " | |
52 << directory.toStdString() << std::endl; | |
53 } | |
54 | |
55 const char * | |
56 DirectoryCreationFailed::what() const throw() | |
57 { | |
58 return QString("Directory creation failed for \"%1\"") | |
59 .arg(m_directory).toLocal8Bit().data(); | |
60 } | |
61 | |
62 FileReadFailed::FileReadFailed(QString file) throw() : | |
63 m_file(file) | |
64 { | |
65 std::cerr << "ERROR: File read failed for file: " | |
66 << file.toStdString() << std::endl; | |
67 } | |
68 | |
69 const char * | |
70 FileReadFailed::what() const throw() | |
71 { | |
72 return QString("File read failed for \"%1\"") | |
73 .arg(m_file).toLocal8Bit().data(); | |
74 } | |
75 | |
76 FileOperationFailed::FileOperationFailed(QString file, QString op) throw() : | |
77 m_file(file), | |
78 m_operation(op) | |
79 { | |
80 std::cerr << "ERROR: File " << op.toStdString() << " failed for file: " | |
81 << file.toStdString() << std::endl; | |
82 } | |
83 | |
84 const char * | |
85 FileOperationFailed::what() const throw() | |
86 { | |
87 return QString("File %1 failed for \"%2\"") | |
88 .arg(m_operation).arg(m_file).toLocal8Bit().data(); | |
89 } | |
90 | |
91 InsufficientDiscSpace::InsufficientDiscSpace(QString directory, | |
92 size_t required, | |
93 size_t available) throw() : | |
94 m_directory(directory), | |
95 m_required(required), | |
96 m_available(available) | |
97 { | |
98 std::cerr << "ERROR: Not enough disc space available in " | |
99 << directory.toStdString() << ": need " << required | |
100 << ", only have " << available << std::endl; | |
101 } | |
102 | |
103 const char * | |
104 InsufficientDiscSpace::what() const throw() | |
105 { | |
106 return QString("Not enough space available in \"%1\": need %2, have %3") | |
107 .arg(m_directory).arg(m_required).arg(m_available).toLocal8Bit().data(); | |
108 } | |
109 |