annotate base/Exceptions.cpp @ 872:afeb580b1b57 tonioni

Add methods to return new Clipboard points with particular characteristics (this is an immutable object)
author Chris Cannam
date Fri, 10 Jan 2014 15:21:01 +0000
parents f5cd33909744
children 6a94bb528e9d
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 #include "Exceptions.h"
Chris@130 17
Chris@130 18 #include <iostream>
Chris@130 19
Chris@843 20 #include "Debug.h"
Chris@843 21
Chris@130 22 FileNotFound::FileNotFound(QString file) throw() :
Chris@130 23 m_file(file)
Chris@130 24 {
Chris@843 25 cerr << "ERROR: File not found: "
Chris@843 26 << file << endl;
Chris@130 27 }
Chris@130 28
Chris@130 29 const char *
Chris@130 30 FileNotFound::what() const throw()
Chris@130 31 {
Chris@130 32 return QString("File \"%1\" not found")
Chris@130 33 .arg(m_file).toLocal8Bit().data();
Chris@130 34 }
Chris@130 35
Chris@130 36 FailedToOpenFile::FailedToOpenFile(QString file) throw() :
Chris@130 37 m_file(file)
Chris@130 38 {
Chris@843 39 cerr << "ERROR: Failed to open file: "
Chris@843 40 << file << endl;
Chris@130 41 }
Chris@130 42
Chris@130 43 const char *
Chris@130 44 FailedToOpenFile::what() const throw()
Chris@130 45 {
Chris@130 46 return QString("Failed to open file \"%1\"")
Chris@130 47 .arg(m_file).toLocal8Bit().data();
Chris@130 48 }
Chris@130 49
Chris@130 50 DirectoryCreationFailed::DirectoryCreationFailed(QString directory) throw() :
Chris@130 51 m_directory(directory)
Chris@130 52 {
Chris@843 53 cerr << "ERROR: Directory creation failed for directory: "
Chris@843 54 << directory << endl;
Chris@130 55 }
Chris@130 56
Chris@130 57 const char *
Chris@130 58 DirectoryCreationFailed::what() const throw()
Chris@130 59 {
Chris@130 60 return QString("Directory creation failed for \"%1\"")
Chris@130 61 .arg(m_directory).toLocal8Bit().data();
Chris@130 62 }
Chris@130 63
Chris@130 64 FileReadFailed::FileReadFailed(QString file) throw() :
Chris@130 65 m_file(file)
Chris@130 66 {
Chris@843 67 cerr << "ERROR: File read failed for file: "
Chris@843 68 << file << endl;
Chris@130 69 }
Chris@130 70
Chris@130 71 const char *
Chris@130 72 FileReadFailed::what() const throw()
Chris@130 73 {
Chris@130 74 return QString("File read failed for \"%1\"")
Chris@130 75 .arg(m_file).toLocal8Bit().data();
Chris@130 76 }
Chris@130 77
Chris@130 78 FileOperationFailed::FileOperationFailed(QString file, QString op) throw() :
Chris@130 79 m_file(file),
Chris@130 80 m_operation(op)
Chris@130 81 {
Chris@843 82 cerr << "ERROR: File " << op << " failed for file: "
Chris@843 83 << file << endl;
Chris@130 84 }
Chris@130 85
Chris@130 86 const char *
Chris@130 87 FileOperationFailed::what() const throw()
Chris@130 88 {
Chris@130 89 return QString("File %1 failed for \"%2\"")
Chris@130 90 .arg(m_operation).arg(m_file).toLocal8Bit().data();
Chris@130 91 }
Chris@130 92
Chris@130 93 InsufficientDiscSpace::InsufficientDiscSpace(QString directory,
Chris@130 94 size_t required,
Chris@130 95 size_t available) throw() :
Chris@130 96 m_directory(directory),
Chris@130 97 m_required(required),
Chris@130 98 m_available(available)
Chris@130 99 {
Chris@843 100 cerr << "ERROR: Not enough disc space available in "
Chris@686 101 << directory << ": need " << required
Chris@843 102 << ", only have " << available << endl;
Chris@130 103 }
Chris@130 104
Chris@544 105 InsufficientDiscSpace::InsufficientDiscSpace(QString directory) throw() :
Chris@544 106 m_directory(directory),
Chris@544 107 m_required(0),
Chris@544 108 m_available(0)
Chris@544 109 {
Chris@843 110 cerr << "ERROR: Not enough disc space available in "
Chris@843 111 << directory << endl;
Chris@544 112 }
Chris@544 113
Chris@130 114 const char *
Chris@130 115 InsufficientDiscSpace::what() const throw()
Chris@130 116 {
Chris@544 117 if (m_required > 0) {
Chris@544 118 return QString("Not enough space available in \"%1\": need %2, have %3")
Chris@544 119 .arg(m_directory).arg(m_required).arg(m_available).toLocal8Bit().data();
Chris@544 120 } else {
Chris@544 121 return QString("Not enough space available in \"%1\"")
Chris@544 122 .arg(m_directory).toLocal8Bit().data();
Chris@544 123 }
Chris@130 124 }
Chris@130 125
Chris@387 126 AllocationFailed::AllocationFailed(QString purpose) throw() :
Chris@387 127 m_purpose(purpose)
Chris@387 128 {
Chris@844 129 cerr << "ERROR: Allocation failed: " << purpose
Chris@843 130 << endl;
Chris@387 131 }
Chris@387 132
Chris@387 133 const char *
Chris@387 134 AllocationFailed::what() const throw()
Chris@387 135 {
Chris@387 136 return QString("Allocation failed: %1")
Chris@387 137 .arg(m_purpose).toLocal8Bit().data();
Chris@387 138 }
Chris@387 139
Chris@387 140