Debian Codegraph @

src/lib/ZMF4Header.cpp

raw symbols SCIP
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /*
3 * This file is a part of the libzmf project.
4 *
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 */
9
10 #include "ZMF4Header.h"
11
12
13 #define ZMF4_SIGNATURE 0x12345678
14
15
16 namespace libzmf
17 {
18
19 ZMF4Header::ZMF4Header()
20 : m_signature(0)
21 , m_objectCount(0)
22 , m_startContentOffset(0)
23 , m_startBitmapOffset(0)
24 {
25 }
26
27 bool ZMF4Header::load(const RVNGInputStreamPtr &input)
28 {
29 seek(input, 8);
30
31 m_signature = readU32(input);
32
33 if (!checkSignature())
34 return false;
35
36 seek(input, 28);
37
38 m_objectCount = readU32(input);
39
40 m_startContentOffset = readU32(input);
41
42 m_startBitmapOffset = readU32(input);
43
44 return true;
45 }
46
47 bool ZMF4Header::isSupported() const
48 {
49 return checkSignature();
50 }
51
52 uint32_t ZMF4Header::objectCount() const
53 {
54 return m_objectCount;
55 }
56
57 uint32_t ZMF4Header::startContentOffset() const
58 {
59 return m_startContentOffset;
60 }
61
62 uint32_t ZMF4Header::startBitmapOffset() const
63 {
64 return m_startBitmapOffset;
65 }
66
67 bool ZMF4Header::checkSignature() const
68 {
69 return m_signature == ZMF4_SIGNATURE;
70 }
71
72 }
73
74 /* vim:set shiftwidth=2 softtabstop=2 expandtab: */