/src/libpagemaker/src/lib/PMDRecord.h
Line | Count | Source |
1 | | /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
2 | | /* |
3 | | * This file is part of the libpagemaker 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 | | #ifndef __PMDRECORD_H__ |
11 | | #define __PMDRECORD_H__ |
12 | | |
13 | | #include <stdint.h> |
14 | | #include <vector> |
15 | | |
16 | | #include <boost/optional.hpp> |
17 | | |
18 | | #include <librevenge/librevenge.h> |
19 | | |
20 | | #include "constants.h" |
21 | | |
22 | | namespace libpagemaker |
23 | | { |
24 | | |
25 | | struct PMDRecordContainer |
26 | | { |
27 | | uint16_t m_recordType; |
28 | | uint32_t m_offset; |
29 | | unsigned m_seqNum; |
30 | | uint16_t m_numRecords; |
31 | | |
32 | | PMDRecordContainer(uint16_t recordType, uint32_t offset, unsigned seqNum, uint16_t numRecords) |
33 | 24 | : m_recordType(recordType), m_offset(offset), m_seqNum(seqNum), |
34 | 24 | m_numRecords(numRecords) |
35 | 24 | { } |
36 | | }; |
37 | | |
38 | | inline boost::optional<unsigned> getRecordSize(uint16_t recType) |
39 | 172k | { |
40 | 172k | switch (recType) |
41 | 172k | { |
42 | 0 | case SHAPE: |
43 | 0 | return 258; |
44 | 0 | case GLOBAL_INFO: |
45 | 0 | return 2496; |
46 | 0 | case PAGE: |
47 | 0 | return 472; |
48 | 0 | case LINE_SET: |
49 | 0 | return 4; |
50 | 172k | case XFORM: |
51 | 172k | return 26; |
52 | 0 | case TEXT_BLOCK: |
53 | 0 | return 36; |
54 | 0 | case CHARS: |
55 | 0 | return 30; |
56 | 0 | case PARA: |
57 | 0 | return 80; |
58 | 0 | case FONTS: |
59 | 0 | return 94; |
60 | 0 | case FONTS_PARENT: |
61 | 0 | return 10; |
62 | 0 | case COLORS: |
63 | 0 | return 210; |
64 | 0 | default: |
65 | 0 | return boost::none; |
66 | 172k | } |
67 | 172k | } |
68 | | |
69 | | } |
70 | | |
71 | | #endif /* __PMDRECORD_H__ */ |
72 | | |
73 | | /* vim:set shiftwidth=2 softtabstop=2 expandtab: */ |