File indexing completed on 2024-04-21 15:23:40

0001 /********************************************************************************
0002  * Copyright (C) 2011-2015 by Stephen Allewell                                  *
0003  * steve.allewell@gmail.com                                                     *
0004  *                                                                              *
0005  * This program is free software; you can redistribute it and/or modify         *
0006  * it under the terms of the GNU General Public License as published by         *
0007  * the Free Software Foundation; either version 2 of the License, or            *
0008  * (at your option) any later version.                                          *
0009  ********************************************************************************/
0010 
0011 
0012 /**
0013  * @file
0014  * Header file for the exception classes.
0015  */
0016 
0017 
0018 #ifndef Exceptions_H
0019 #define Exceptions_H
0020 
0021 
0022 #include <QDataStream>
0023 #include <QtGlobal>
0024 
0025 
0026 /**
0027  * @brief Invalid file exception class.
0028  *
0029  * This is thrown when the file being opened is not a symbol library.
0030  */
0031 class InvalidFile
0032 {
0033 public:
0034     InvalidFile();
0035     ~InvalidFile();
0036 
0037 private:
0038 };
0039 
0040 
0041 /**
0042  * @brief Invalid file version exception class.
0043  *
0044  * This is thrown when the library file opened is a version that is not known.
0045  */
0046 class InvalidFileVersion
0047 {
0048 public:
0049     explicit InvalidFileVersion(qint32 v);
0050     ~InvalidFileVersion();
0051 
0052     qint32 version;                 /**< the version of the file read */
0053 };
0054 
0055 
0056 /**
0057  * @brief Failed to read the library exception class.
0058  *
0059  * This is thrown when there was an error reading the QDataStream.
0060  */
0061 class FailedReadLibrary
0062 {
0063 public:
0064     explicit FailedReadLibrary(QDataStream::Status status);
0065     ~FailedReadLibrary();
0066 
0067     QString statusMessage() const;
0068 
0069 private:
0070     QDataStream::Status m_status;   /**< the status of the error */
0071 };
0072 
0073 
0074 /**
0075  * @brief Failed to write the library exception class.
0076  *
0077  * This is thrown when there was an error reading the QDataStream.
0078  */
0079 class FailedWriteLibrary
0080 {
0081 public:
0082     explicit FailedWriteLibrary(QDataStream::Status status);
0083     ~FailedWriteLibrary();
0084 
0085     QString statusMessage() const;
0086 
0087 private:
0088     QDataStream::Status m_status;   /**< the status of the error */
0089 };
0090 
0091 
0092 /**
0093  * @brief Found an invalid symbol version.
0094  *
0095  * This is thrown when the symbol being read was not a known version.
0096  */
0097 class InvalidSymbolVersion
0098 {
0099 public:
0100     explicit InvalidSymbolVersion(qint32 v);
0101     ~InvalidSymbolVersion();
0102 
0103     qint32  version;                /** the version of the symbol read */
0104 };
0105 
0106 
0107 #endif