1 // This file is part of the interchange file format library.
3 // Copyright (C) 2003-2006 by Mike Sharov <msharov@users.sourceforge.net>
4 // This file is free software, distributed under the MIT License.
13 //----------------------------------------------------------------------
15 /// Verifies that the chunk is of \p fmt, or throws an exception.
16 void CChunkHeader::Verify (fmt_t fmt
, const char* chunkName
, uoff_t offset
) const
18 if (m_Format
!= fmt
&& fmt
!= cfmt_Autodetect
)
19 throw XFormatMismatch (chunkName
, offset
, fmt
, m_Format
);
22 //----------------------------------------------------------------------
24 /// Initializes empty header.
25 CGroupHeader::CGroupHeader (void)
26 : CChunkHeader (stream_size() - CChunkHeader::stream_size(), cfmt_Generic
),
27 m_ChildFormat (cfmt_Generic
)
31 /// Initializes header with given parameters
32 CGroupHeader::CGroupHeader (chsize_t size
, fmt_t childFormat
, fmt_t fmt
)
33 : CChunkHeader (size
+ (stream_size() - CChunkHeader::stream_size()), fmt
),
34 m_ChildFormat (childFormat
)
38 /// Verifies that the vector is of \p fmt, or throws an exception.
39 void CGroupHeader::Verify (fmt_t childFmt
, fmt_t fmt
, const char* chunkName
, uoff_t offset
) const
41 CChunkHeader::Verify (fmt
, chunkName
, offset
);
42 if (m_ChildFormat
!= childFmt
&& childFmt
!= cfmt_Autodetect
)
43 throw XFormatMismatch (chunkName
, offset
, childFmt
, m_ChildFormat
);
46 //----------------------------------------------------------------------