Exceptions.cpp

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 #include "Exceptions.h"
00017 
00018 #include <iostream>
00019 
00020 FileNotFound::FileNotFound(QString file) throw() :
00021     m_file(file)
00022 {
00023     std::cerr << "ERROR: File not found: "
00024               << file.toStdString() << std::endl;
00025 }
00026 
00027 const char *
00028 FileNotFound::what() const throw()
00029 {
00030     return QString("File \"%1\" not found")
00031         .arg(m_file).toLocal8Bit().data();
00032 }
00033 
00034 FailedToOpenFile::FailedToOpenFile(QString file) throw() :
00035     m_file(file)
00036 {
00037     std::cerr << "ERROR: Failed to open file: "
00038               << file.toStdString() << std::endl;
00039 }
00040 
00041 const char *
00042 FailedToOpenFile::what() const throw()
00043 {
00044     return QString("Failed to open file \"%1\"")
00045         .arg(m_file).toLocal8Bit().data();
00046 }
00047 
00048 DirectoryCreationFailed::DirectoryCreationFailed(QString directory) throw() :
00049     m_directory(directory)
00050 {
00051     std::cerr << "ERROR: Directory creation failed for directory: "
00052               << directory.toStdString() << std::endl;
00053 }
00054 
00055 const char *
00056 DirectoryCreationFailed::what() const throw()
00057 {
00058     return QString("Directory creation failed for \"%1\"")
00059         .arg(m_directory).toLocal8Bit().data();
00060 }
00061 
00062 FileReadFailed::FileReadFailed(QString file) throw() :
00063     m_file(file)
00064 {
00065     std::cerr << "ERROR: File read failed for file: "
00066               << file.toStdString() << std::endl;
00067 }
00068 
00069 const char *
00070 FileReadFailed::what() const throw()
00071 {
00072     return QString("File read failed for \"%1\"")
00073         .arg(m_file).toLocal8Bit().data();
00074 }
00075 
00076 FileOperationFailed::FileOperationFailed(QString file, QString op) throw() :
00077     m_file(file),
00078     m_operation(op)
00079 {
00080     std::cerr << "ERROR: File " << op.toStdString() << " failed for file: "
00081               << file.toStdString() << std::endl;
00082 }
00083 
00084 const char *
00085 FileOperationFailed::what() const throw()
00086 {
00087     return QString("File %1 failed for \"%2\"")
00088         .arg(m_operation).arg(m_file).toLocal8Bit().data();
00089 }
00090 
00091 InsufficientDiscSpace::InsufficientDiscSpace(QString directory,
00092                                              size_t required,
00093                                              size_t available) throw() :
00094     m_directory(directory),
00095     m_required(required),
00096     m_available(available)
00097 {
00098     std::cerr << "ERROR: Not enough disc space available in "
00099               << directory.toStdString() << ": need " << required
00100               << ", only have " << available << std::endl;
00101 }
00102 
00103 const char *
00104 InsufficientDiscSpace::what() const throw()
00105 {
00106     return QString("Not enough space available in \"%1\": need %2, have %3")
00107         .arg(m_directory).arg(m_required).arg(m_available).toLocal8Bit().data();
00108 }
00109 

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