Clarified that group chunks must have chunks in them
[iffl.git] / xept.h
blob2b7c71938a6f10a1669bde1230f68ada78f98d27
1 // This file is part of the interchange file format library.
2 //
3 // Copyright (C) 2003-2006 by Mike Sharov <msharov@users.sourceforge.net>
4 // This file is free software, distributed under the MIT License.
5 //
6 // xept.h
7 //
8 // Exceptions thrown by iff library functions.
9 //
11 #ifndef XEPT_H_1166C45177F868B740FD8B3221078767
12 #define XEPT_H_1166C45177F868B740FD8B3221078767
14 #include "heads.h"
16 namespace iff {
18 //----------------------------------------------------------------------
19 // Exception definitions
20 //----------------------------------------------------------------------
22 /// \class XFormatMismatch xept.h iff.h
23 /// \brief Thrown when the format of the block being read does not match the format requested.
24 class XFormatMismatch : public exception {
25 public:
26 XFormatMismatch (const char* typeName, uoff_t offset, fmt_t expected, fmt_t actual) throw();
27 virtual const char* what (void) const throw() { return ("IFF format mismatch"); }
28 virtual void info (string& msgbuf, const char* fmt) const throw();
29 private:
30 const char* m_TypeName;
31 uoff_t m_Offset;
32 fmt_t m_Expected;
33 fmt_t m_Actual;
36 /// \class XChunkSizeMismatch xept.h iff.h
37 /// \brief Thrown when the calculated size of the block being read differs from the given size.
38 class XChunkSizeMismatch : public exception {
39 public:
40 XChunkSizeMismatch (const char* typeName, uoff_t offset, size_t expected, size_t actual) throw();
41 virtual const char* what (void) const throw() { return ("IFF chunk size mismatch"); }
42 virtual void info (string& msgbuf, const char* fmt) const throw();
43 protected:
44 const char* m_TypeName;
45 uoff_t m_Offset;
46 size_t m_Expected;
47 size_t m_Actual;
50 } // namespace iff
52 #endif