File indexing completed on 2024-04-21 04:34:00
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() = default; 0035 }; 0036 0037 0038 /** 0039 * @brief Invalid file version exception class. 0040 * 0041 * This is thrown when the library file opened is a version that is not known. 0042 */ 0043 class InvalidFileVersion 0044 { 0045 public: 0046 explicit InvalidFileVersion(qint32 v); 0047 0048 qint32 version; /**< the version of the file read */ 0049 }; 0050 0051 0052 /** 0053 * @brief Failed to read the library exception class. 0054 * 0055 * This is thrown when there was an error reading the QDataStream. 0056 */ 0057 class FailedReadLibrary 0058 { 0059 public: 0060 explicit FailedReadLibrary(QDataStream::Status status); 0061 0062 QString statusMessage() const; 0063 0064 private: 0065 QDataStream::Status m_status; /**< the status of the error */ 0066 }; 0067 0068 0069 /** 0070 * @brief Failed to write the library exception class. 0071 * 0072 * This is thrown when there was an error reading the QDataStream. 0073 */ 0074 class FailedWriteLibrary 0075 { 0076 public: 0077 explicit FailedWriteLibrary(QDataStream::Status status); 0078 0079 QString statusMessage() const; 0080 0081 private: 0082 QDataStream::Status m_status; /**< the status of the error */ 0083 }; 0084 0085 0086 /** 0087 * @brief Found an invalid symbol version. 0088 * 0089 * This is thrown when the symbol being read was not a known version. 0090 */ 0091 class InvalidSymbolVersion 0092 { 0093 public: 0094 explicit InvalidSymbolVersion(qint32 v); 0095 0096 qint32 version; /** the version of the symbol read */ 0097 }; 0098 0099 0100 #endif