| 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 "ZBRHeader.h" |
| 11 | |
| 12 | #define ZBR_SIG 0x29a |
| 13 | |
| 14 | namespace libzmf |
| 15 | { |
| 16 | |
| 17 | ZBRHeader::ZBRHeader() |
| 18 | : m_sig(0) |
| 19 | , m_version(0) |
| 20 | { |
| 21 | } |
| 22 | |
| 23 | bool ZBRHeader::load(const RVNGInputStreamPtr &input) try |
| 24 | { |
| 25 | m_sig = readU16(input); |
| 26 | m_version = readU16(input); |
| 27 | skip(input, 100); |
| 28 | return true; |
| 29 | } |
| 30 | catch (...) |
| 31 | { |
| 32 | return false; |
| 33 | } |
| 34 | |
| 35 | bool ZBRHeader::isSupported() const |
| 36 | { |
| 37 | return m_sig == ZBR_SIG && m_version < 5; |
| 38 | } |
| 39 | |
| 40 | unsigned ZBRHeader::version() const |
| 41 | { |
| 42 | return m_version; |
| 43 | } |
| 44 | |
| 45 | } |
| 46 | |
| 47 | /* vim:set shiftwidth=2 softtabstop=2 expandtab: */ |